Results 1 to 4 of 4

Thread: Pop up Menu Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    67

    Smile

    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.



  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    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

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Talking 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]
    ~seaweed

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