• 0

VB6 Popup Menu Help!


Question

Hi, i'm doing a school project and i need to make a popup menu, but dam ... everytime a press the the right mouse button it shows me first the system menu and then my own menu, what's is wrong with this code:

Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim blnAlt As Boolean
Dim blnShift As Boolean
Dim blnCtrl As Boolean

blnAlt = Shift And vbAltMask
blnShift = Shift And vbShiftMask
blnCtrl = Shift And vbCtrlMask

If (Button = vbLeftButton) Then
    Text1.Enabled = True
    If (blnAlt And blnShift) Then
        MsgBox "ALT e SHIFT mais o bot?o esquerdo do rato"
    End If
End If

If (Button = vbRightButton) Then
    Text1.Enabled = True
    PopupMenu mnuForm
End If

End Sub

can someone help me please!!!

Thanks

UltraMAX

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

You must first disable and after enable the textbox to avoid system menu to pops up and this only happens at MouseDown event.

So, the code will look like this

Private Sub Text1_MouseDown(Button As Integer, _

Shift As Integer, _

X As Single, Y As Single)

Dim blnAlt As Boolean

Dim blnShift As Boolean

Dim blnCtrl As Boolean

blnAlt = Shift And vbAltMask

blnShift = Shift And vbShiftMask

blnCtrl = Shift And vbCtrlMask

If (Button = vbLeftButton) Then

Text1.Enabled = True

If (blnAlt And blnShift) Then

MsgBox "ALT e SHIFT mais o botao esquerdo do rato"

End If

End If

If (Button = vbRightButton) Then

Text1.Enabled = False

Text1.Enabled = True

Text1.SetFocus

PopupMenu mnuForm

End If

End Sub

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.