searching a text and popup menu

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2006
Posts: 10
Reputation: b.janahi is an unknown quantity at this point 
Solved Threads: 0
b.janahi b.janahi is offline Offline
Newbie Poster

searching a text and popup menu

 
0
  #1
Jul 4th, 2006
if i have this text

<br />
INPUT STRING: شمس<br />
LOOK-UP WORD: $ms<br />
 <br />
SOLUTION 1: ($amasa) [$amas-u_1] $amas/VERB_PERFECT+a/PVSUFF_SUBJ:3MS<br />
(GLOSS): + be headstrong + he/it <verb><br />
 <br />
SOLUTION 2: ($amisa) [$amis-a_1] $amis/VERB_PERFECT+a/PVSUFF_SUBJ:3MS<br />
(GLOSS): + be sunny + he/it <verb><br />
 <br />
SOLUTION 3: ($am~asa) [$am~as_1] $am~as/VERB_PERFECT+a/PVSUFF_SUBJ:3MS<br />
(GLOSS): + expose to the sun + he/it <verb><br />
 <br />
SOLUTION 4: ($amos) [$amos_1] $amos/NOUN<br />
(GLOSS): + sun + <br />
 <br />
SOLUTION 5: ($amos) [$amos_2] $amos/NOUN_PROP<br />
(GLOSS): + Shams + <br />
 <br />
INPUT STRING: البحرين<br />
LOOK-UP WORD: AlbHryn<br />
 <br />
SOLUTION 1: (AlbaHorayoni) [baHorayoni_1] Al/DET+baHorayoni/NOUN_PROP<br />
(GLOSS): the + Bahrain + <br />
 <br />
SOLUTION 2: (AlbaHorayoni) [baHor_1] Al/DET+baHor/NOUN+ayoni/NSUFF_MASC_DU_ACCGEN<br />
(GLOSS): the + sea + two<br />
 <br />


and i want to take the solutions and put them in a popup menu
for example for the first INPUT STRING: شمس
the options should be
1.$amasa
2.$amisa
3.$am~asa
4.$amos
5.$amos

when user right click on that word the five options should appear


i tried to search the text to find the first option but how can i put it in the popup menu and how can i find other solutions


this is the code i used
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub FindText(ByVal start_at As Integer)
  2. Dim pos As Integer
  3. Dim target As String
  4. target = "SOLUTION"
  5.  
  6.  
  7.  
  8. pos = InStr(start_at, txtBody.Text, target)
  9. If pos > 0 Then
  10. 'We found it.
  11. TargetPosition = pos
  12. txtBody.SelStart = TargetPosition + 12
  13. txtBody.SelLength = Len(target) - 2
  14. txtBody.SetFocus
  15.  
  16. Else
  17. 'We did not find it.
  18. MsgBox "Not found."
  19. txtBody.SetFocus
  20. End If
  21.  
  22.  
  23. End Sub



how can i stop seleting until i reach ')'
anybody help
Last edited by b.janahi; Jul 4th, 2006 at 6:17 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: searching a text and popup menu

 
0
  #2
Jul 6th, 2006
Is it all in the same line, like the picture that you have posted? If not, how does it look exactly, can you paste some of the file in code tags. I can help you much more with that then.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 10
Reputation: b.janahi is an unknown quantity at this point 
Solved Threads: 0
b.janahi b.janahi is offline Offline
Newbie Poster

Re: searching a text and popup menu

 
0
  #3
Jul 6th, 2006
i think that i should explain what i want to do

first i should run a perl script from vb
i should pass an arabic encoding .txt file to perl to get another .txt file, pearl scirpt should analyze all arabic words and proceed all possible options that could match with all word in the output file

so my job is to let user rigth click on the word and get the options then he should select the wright option that he mean


this is an example of the output that i want to process

INPUT STRING: (
Comment: Non-Alphabetic Data

INPUT STRING: دهب
LOOK-UP WORD: dhb
Comment: dhb NOT FOUND

INPUT STRING: )
Comment: Non-Alphabetic Data

INPUT STRING: Yes
Comment: Non-Alphabetic Data

INPUT STRING: كم
LOOK-UP WORD: km
SOLUTION 1: (kam) [kam_1] kam/REL_PRON
(GLOSS): + how many/much +
SOLUTION 2: (kam) [kam_2] kam/INTERROG_PART
(GLOSS): + how many/much +
SOLUTION 3: (km) [kam_2] km/ABBREV
(GLOSS): + kilometer(s) +
SOLUTION 4: (kam~a) [kam~-u_1] kam~/VERB_PERFECT+a/PVSUFF_SUBJ:3MS
(GLOSS): + cover/hide + he/it <verb>
SOLUTION 5: (kam~) [kam~_1] kam~/NOUN
(GLOSS): + amount/quantity +


in ths case i have only 5 inpt strings they r
دهب (this is an arabic word with no meaning) ____ not found
) (not arabic text) ______Non-Alphabetic Data
Yes (not arabic )____Non-Alphabetic Data
( (not arabic )_____Non-Alphabetic Data
كم (an arabic word with five solutions)


so if user rigth clicked the word دهب then popup menu will appear with (not found)
and for the brackets the popup will be (Non-Alphabetic Data)
but in case of the word كم five options will appear


the problem i face is how to saparate each word options and link them to the word it self in the original textbox



this is the code that i wrote to find all of the options and put them in a list
this code can be applyed for an arabic text with solutions only



Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2. Private Target2Position As Integer
  3. Private TargetPosition As Integer
  4.  
  5. ' Find the text.
  6. Private Sub cmdFind_Click()
  7. FindText 1
  8. End Sub
  9. Private Sub FindText(ByVal start_at As Integer)
  10. Dim pos As Integer
  11. Dim pos2 As Integer
  12. Dim target As String
  13. Dim target2 As String
  14.  
  15. target = "SOLUTION"
  16. target2 = ")"
  17.  
  18. pos = InStr(start_at, txtBody.Text, target)
  19.  
  20. If pos > 0 Then
  21. 'We found it.
  22. start_at = pos + 12
  23.  
  24. pos2 = InStr(start_at, txtBody.Text, target2)
  25. Target2Position = pos2
  26.  
  27.  
  28. TargetPosition = pos
  29. txtBody.SelStart = TargetPosition + 12
  30. txtBody.SelLength = Target2Position - TargetPosition - 13
  31.  
  32. txtBody.SetFocus
  33.  
  34. Else
  35. 'We did not find it.
  36. MsgBox "Not found."
  37. txtBody.SetFocus
  38. End If
  39.  
  40.  
  41. Text1.Text = txtBody.SelText
  42. List1.AddItem (Text1.Text)
  43.  
  44. cmdFind.Enabled = False
  45.  
  46.  
  47. End Sub
  48. ' Find the next occurrance of the text.
  49.  
  50. Private Sub cmdFindNext_Click()
  51. FindText Target2Position + 1
  52.  
  53. End Sub
Last edited by b.janahi; Jul 6th, 2006 at 5:02 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC