Results 1 to 12 of 12

Thread: PopMenu

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question PopMenu

    Hi...
    in my project i have a function (translate()) it can translate a words frome notepade file to other notepade file, then i want to take the words in the second notepade to replace it with the words in popmenu.
    (The popmenu appear when we click right click on the word we have it in RichTextBox)

    please, help me if any body have an idea?

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: PopMenu

    VB Code:
    1. Private Sub RichTextBox1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     If Button = 2 Then PopupMenu [I]menuNameHere[/I]
    3. End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question Re: PopMenu

    Hi gavio...
    i do this step in project..
    But now i want to replace the word in this popmenu with the words in notepade file.
    How?

  4. #4

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question Re: PopMenu

    hi..
    when i do right click on the word in RichTxetBox, the word is highlight and the PopMenu appear with some words in it, So i want to replace (translate) these word in PopMenu with the word in NotePade.
    Thanks

  6. #6
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: PopMenu

    Try something like this:
    VB Code:
    1. Private Sub RichTextBox1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     If Button = 2 Then
    3.         With RichTextBox1
    4.             If .SelText <> vbNullString Then
    5.                 mnuSubMenu.Caption = .SelText
    6.             Else
    7.                 mnuSubMenu.Caption = "No word selected"
    8.             End If
    9.                 PopupMenu mnuMenu
    10.         End With
    11.     End If
    12. End Sub

  7. #7

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question Re: PopMenu

    Hi gavio...
    This is my code to what i say it before about right click on the word, So i want now to replace the word that appear in popup menu with the word i have it in notepade...
    Is there any idea to do that?

    VB Code:
    1. Private Sub RichTextBox1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim sLoc As Integer
    3.     Dim eLoc As Integer
    4.     Dim wrds() As String
    5.     Dim tmp() As String
    6.     Dim i As Integer
    7.     If Button = 2 Then
    8.         If Trim(RichTextBox1.SelText) = "" Then
    9.             If RichTextBox1.SelStart = 0 Then Exit Sub
    10.             sLoc = InStrRev(RichTextBox1.Text, " ", RichTextBox1.SelStart)
    11.             eLoc = InStr(RichTextBox1.SelStart, RichTextBox1.Text, " ") - 1
    12.             RichTextBox1.SelStart = sLoc
    13.             RichTextBox1.SelLength = eLoc - sLoc '+ 1
    14.         End If
    15.         If Trim(RichTextBox1.SelText) <> "" Then
    16.             For x = mnuWord.UBound To 1 Step -1
    17.                 Unload mnuWord(x)
    18.             Next
    19.            mnuWord(0).Caption = "NOT FOUND"
    20.             For x = 0 To UBound(WORDLIST)
    21.                 tmp = Split(WORDLIST(x), ":")
    22.                 If tmp(0) = Trim(RichTextBox1.SelText) Then
    23.                     wrds = Split(tmp(1), ";")
    24.                     For i = 0 To UBound(wrds)
    25.                         If i = 0 Then
    26.                             mnuWord(0).Caption = wrds(i)                              
    27.                         Else
    28.                             Load mnuWord(i)
    29.                             mnuWord(i).Visible = True
    30.                             mnuWord(i).Caption = wrds(i)
    31.                         End If
    32.                     Next
    33.                 End If
    34.             Next
    35.             PopupMenu mnuPop
    36.         End If
    37.     End If
    38. End Sub

  8. #8

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question Re: PopMenu

    Hi...
    please, help me to do my project...
    Thanks.

  9. #9

  10. #10

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question Re: PopMenu

    Hi gavio...
    i attach the form, But this is the second form the first form we called it main and in the main form we have textBox (txtFileText) we load in it arabic paragraph then we run in DOS (Buckwalter code),
    After that it will go to that form (first) and get that paragraph to the RichTextBox, So when we do right click on any word we show a popupmenu with one word or more and these words in buckwalter transelation.
    and i want to back these word in Buckwalter to Arabic (we have arabic word in translate() function)
    for example:
    if we do right click then in PopMenu we can find that:
    $amasa
    $amisa
    $am~asa
    $amos
    $amos
    we want to chang the above words with the below words and these words we can find it in translate function in (newoutfile.txt) NotePade file..
    شَمَسَ
    شَمِسَ
    شَمَّسَ
    شَمْس
    شَمْس

    can we make join between the PopUpMenu and the notepade in translate function..
    thanks,
    Attached Files Attached Files

  11. #11

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question Re: PopMenu

    Hi gavio..
    I send the form see it, and if U have any solution please replay to me

    Thanks a lot

  12. #12

    Thread Starter
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Question Re: PopMenu

    Hi...
    I need help please.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width