User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 425,929 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,691 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 1475 | Replies: 2
Reply
Join Date: Jun 2006
Posts: 10
Reputation: b.janahi is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
b.janahi b.janahi is offline Offline
Newbie Poster

searching a text and popup menu

  #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
Private Sub FindText(ByVal start_at As Integer)
Dim pos As Integer
Dim target As String
    target = "SOLUTION"
 
 
 
    pos = InStr(start_at, txtBody.Text, target)
    If pos > 0 Then
        'We found it.
        TargetPosition = pos
        txtBody.SelStart = TargetPosition + 12
        txtBody.SelLength = Len(target) - 2
        txtBody.SetFocus
 
    Else
        'We did not find it.
        MsgBox "Not found."
        txtBody.SetFocus
    End If
 
 
End Sub



how can i stop seleting until i reach ')'
anybody help
Last edited by b.janahi : Jul 4th, 2006 at 5:17 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: searching a text and popup menu

  #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  
Join Date: Jun 2006
Posts: 10
Reputation: b.janahi is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
b.janahi b.janahi is offline Offline
Newbie Poster

Re: searching a text and popup menu

  #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



Option Explicit
Private Target2Position As Integer
Private TargetPosition As Integer
 
' Find the text.
Private Sub cmdFind_Click()
    FindText 1
End Sub
Private Sub FindText(ByVal start_at As Integer)
Dim pos As Integer
Dim pos2 As Integer
Dim target As String
Dim target2 As String
 
    target = "SOLUTION"
    target2 = ")"
 
    pos = InStr(start_at, txtBody.Text, target)
 
    If pos > 0 Then
        'We found it.
        start_at = pos + 12
 
       pos2 = InStr(start_at, txtBody.Text, target2)
       Target2Position = pos2
 
 
        TargetPosition = pos
        txtBody.SelStart = TargetPosition + 12
        txtBody.SelLength = Target2Position - TargetPosition - 13
 
        txtBody.SetFocus
 
    Else
        'We did not find it.
        MsgBox "Not found."
        txtBody.SetFocus
    End If
 
 
    Text1.Text = txtBody.SelText
    List1.AddItem (Text1.Text)
 
    cmdFind.Enabled = False
 
 
End Sub
' Find the next occurrance of the text.
 
Private Sub cmdFindNext_Click()
    FindText Target2Position + 1
 
End Sub
Last edited by b.janahi : Jul 6th, 2006 at 4:02 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 9:11 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC