Results 1 to 3 of 3

Thread: Dynamic popup menu

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Location
    Wellington, NZ
    Posts
    267

    Dynamic popup menu

    I want to create a popup menu. There will be a variable number of items in the popup menu (dont know how many). If an item is clicked, some action might be performed (I'll work that out), but a sub-popup menu might need to be produced. Can anyone get me started ?

  2. #2
    New Member
    Join Date
    Sep 2005
    Posts
    10

    Re: Dynamic popup menu

    The way that I do it is to create all the possible menu options using the menu editor and then set the standard items to show as visible, and all the others to non-visible.

    Then where the code to show the popup is run, I just change the visibility of any extra menu items needed before the line to open the menu.

    Probably not the best way to do it, but it's nice and simple.

  3. #3
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Dynamic popup menu

    Quote Originally Posted by RobertLees
    I want to create a popup menu. There will be a variable number of items in the popup menu (dont know how many). If an item is clicked, some action might be performed (I'll work that out), but a sub-popup menu might need to be produced. Can anyone get me started ?
    add your menu (and submenus) to the menu editor
    hide the menu with mnuName.visible=false (mnuName being the name of the menu)
    then all you have to do is do this: (put it in a mousedown event)
    using right mouse button (on form)
    VB Code:
    1. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     If Button = vbRightButton Then
    3.         PopupMenu mnuName
    4.     End If
    5. End Sub
    using left mouse button (on form)
    VB Code:
    1. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     If Button = vbLeftButton Then
    3.         PopupMenu mnuName
    4.     End If
    5. End Sub

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