Results 1 to 5 of 5

Thread: How do I make a menu popup from a CommandButton?

  1. #1
    Join Date
    Jan 2009
    Posts
    18

    How do I make a menu popup from a CommandButton?

    Hi,

    How do I make a menu popup from a CommandButton?

    I want the code to popup a menu on a CommandButton & it has OK button on it.

    Regards!

  2. #2
    Join Date
    Jun 2008
    Posts
    97

    Re: How do I make a menu popup from a CommandButton?

    Pop-ups

    According to the Microsoft’s terminology, the term “pop-up” can be used for several controls: pop-up menu, pop-up button, and submenu. With Add-in Express you can create your own pop-up as an element of your controls commandbar collection and add to it any control via the Controls property. But pop-ups have a feature that is very annoying: if an edit box or a combo box is added to a pop-up, their events are fired very oddly. Don’t regard this bug as that of Add-in Express. It seems to be intended by Microsoft.

  3. #3
    Join Date
    May 2008
    Posts
    115

    Re: How do I make a menu popup from a CommandButton?

    Code:
    MsgBox "Your Message", vbExclamation + vbOKOnly, "Box Title"
    You can remove the "vbExclamation +", or replace it with vbCritical, vbQuestion... Just select one from the list you get when writing down ur code.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How do I make a menu popup from a CommandButton?

    Making & using a PopUp Menu

    Making a popup menu (vb4)

    step 1: starting
    step 2: make the menu-options
    step 3: make the code
    step 4: let the popup appears
    step 5: running....


    step 1: starting

    make a new project; a new form; some labels with caption; some textboxes
    and some commandbuttons


    step 2: make the menu-options

    - view the form
    - choose Tools/Menu Editor
    - make a option:
    caption = Testing
    name = dummy
    visible = FALSE
    - make some sub-options:
    caption = &Clear
    name = testing
    index = 1
    caption = &Print
    name = testing
    index = 2
    - click on OKE


    step 3: make the code

    - view code of the form
    - choose for Object = testing
    - place the next code:

    Select case Index
    Case 1 'clear
    Call ClearAll
    Case 2 'print
    PrintForm
    End Select

    in the general section place the next proc:

    Private sub ClearAll()
    Dim Control

    For Each Control In Form1.Controls
    If TypeOf Control Is TextBox Then Control.Text = ""
    If TypeOf Control Is Label Then Control.Caption = ""
    If TypeOf Control Is CommandButton Then Control.Caption = ""
    Next Control

    End Sub



    step 4: let the popup appears

    - place in the MouseDown event of every control you want to accept
    a request for the popup to show the next code

    Private sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If button = 2 Then Me.PopupMenu dummy
    End Sub

    step 5: press F5 and click the right button on different locations on the form.


    Of course it's just an example. You can let different popupmenus appear with different
    controls. All with different options. It's just for the idea..

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    Re: How do I make a menu popup from a CommandButton?

    If you have added a menu using the form's menu editor, then you can make a popup menu by using:
    Form1.PopUpMenu menuheadername

Similar Threads

  1. popup menu in Firefox hosed when used on Mac
    By Jagathi in forum Technology & Internet
    Replies: 7
    Last Post: 29-06-2011, 09:12 PM
  2. How to make menu button red in opera 11.50
    By Condolem in forum Technology & Internet
    Replies: 4
    Last Post: 20-06-2011, 04:27 AM
  3. Creating a Popup Menu in java
    By Adrina_g in forum Software Development
    Replies: 4
    Last Post: 25-02-2010, 10:29 PM
  4. Replies: 1
    Last Post: 14-04-2009, 01:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,033,132.51256 seconds with 16 queries