|
-
Nov 3rd, 2000, 06:14 PM
#1
Thread Starter
Lively Member
I have a simple form that I've made. In the middle of it is a clock (label). When you right click anywhere on the form, the pop up menu appears. If you right click on the label (the clock) nothing happens. What have I done wrong? I want the pop up to display from anywhere on the form, including label.
Thank you.
-
Nov 3rd, 2000, 06:16 PM
#2
Monday Morning Lunatic
Try adding the code to the label's Click event.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 3rd, 2000, 06:36 PM
#3
_______
<?>
Code:
'This will fire your popup at the mousepointer
'except when on the label and it will then fire
'it up at the label topleft
'make a popup menu just like the one's in windows
'appear at the right click of your mouse as long
'as your right click is on the form
Option Explicit
Private Sub Form_Load()
mnuPopUP.Visible = False
End Sub
'
'allow users the ability of win keyboard menu key
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 93 Then
'fire up the popup menu
PopupMenu mnuPopUP, 2, 60, 60
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'fire up the popup menu
PopupMenu mnuPopUP, 2, X, Y
End If
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'fire up the popup menu
PopupMenu mnuPopUP, 2, X, Y
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 3rd, 2000, 06:38 PM
#4
Frenzied Member
You have to call the form's mouse up event from the label control's mouse up event
Try this:
Code:
' Pretend this is your form code to make the popup menu appear
' when the user right-clicks:
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Me.PopupMenu mnuHello
End If
End Sub
' But when they right click the label, the Form_MouseUp event
' doesn't fire, so you have to call it yourself (and pass the
' parameters along...
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Call Form_MouseUp(vbRightButton, Shift, X + Label1.Left, Y + Label1.Top)
End If
End Sub
[Edited by seaweed on 11-03-2000 at 06:42 PM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|