featured products
exg2antt exfileview explorertree

How do you find the control's help / documentation on your computer:

Exontrol Software - ExPopupMenu FAQ page

Frequently Asked Questions - ExPopupMenu Component

Listed below are the questions that we are asked quite often. Before you write us, be sure to check here. 

Are you looking for something?

Just press CTRL+F ( or select Edit\Find menu item ) and you have a dialog that will help you to locate the string that are you looking for.

Where can I find the control's release notes?

The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link. 

How do I popup the menu?

The control provides two properties: Show and ShowAtCursor. The Show property requires x and y coordinates where the popup menu will be displayed. The ShowAtCursor property doesn't require any additional parameters. Both properties return the identifier of selected item. The Command property can be used to retrieve the selected item. For instance:

Dim i As Long
i = PopupMenu1.ShowAtCursor()

Is there any way to add new items at runtime?

The Items property of control retrieves the collection of items. The Items property gets an object of Menu type. The EXPOPUPMENULibCtl.Menu object exports methods like Add, Remove, Clear to add or remove items at runtime. For instance, the following sample adds a separator item:

With PopupMenu1.Items
        .Add "", Separator  ' Adds a separator item
End With
The following sample adds a new sub menu to the control:
With PopupMenu1.Items
        With .Add("Popup", SubMenu).SubMenu
            .Add "Item 1", Default, 1001
            .Add "Item 2", Default, 1002
            .Add "Item 3", Default, 1003
        End With
End With

The following sample adds a new item and associates an image to it:

With PopupMenu1.Items
        With .Add("Item 1", Default, 1001)
            .Image = 1
        End With
End With 

How can I find the entire list of properties, methods and objects for this control?

In VB environment, the F2 opens the object browser. Select the EXPOPUPMENULibCtl item, and you have the entire list of exported objects, properties and methods. 

Since we need this for our intranet application running on IE5+, wanted to know if this product is meant for internet apps?

Yes. The control can be used in a script environment such as IE. The setup installs a WEB folder where you can find the sample.htm file. The sample shows how ExPopupMenu and ExMenuButton controls work.

I want to attach a popup menu to command button ( drop down command button ). Is this possible?

Yes. The control's library provides a MenuButton object that helps you to attach a popup menu to a command button. The following code associates a popup menu object to the menu button control:

Set MenuButton1.Menu = PopupMenu1

The menu button's caption is not changed automatically when the user selects a new item from the popup menu, so you have to handle the Click event like in the following sample:

Private Sub MenuButton1_Click()
    If (MenuButton1.LastID > 0) Then
        MenuButton1.Caption = PopupMenu1.Command(MenuButton1.LastID).Caption
        MenuButton1.Picture = PopupMenu1.Command(MenuButton1.LastID).Image
    End If
    Debug.Print "Apply the changes for ... " & MenuButton1.Caption
End Sub

You can notice that LastID property of the MenuButton object retrieves the last identifier selected by the user. 

It would be nice to have the ability to mark some items using bold or italic font attribute. Is this possible?

More than that, the version 1.0.1.4 adds the ability to use built-in HTML format in item's caption. The built-in HTML tags supported are:

  • <b>  bold </b>
  • <u> underline </u>
  • <s> strikeout </s>
  • <i> italic </i>
  • <fgcolor = FF0000> fgcolor </fgcolor>
  • <bgcolor = FF0000> bgcolor </bgcolor>
  • <br> breaks a line. 
  • <solidline> draws a solid line
  • <dotline> draws a dotted line
  • <upline> draws the line to the top of the text line
  • <r> aligns the rest of the text line to the right side

The following sample bolds an item:

PopupMenu1.Command(1).Caption = "<b>" & PopupMenu1.Command(1).Caption & "</b>"

In design mode, I've added items to a popup menu, and I want to move one to another position. What should I do?

Open the control's menu editor ( by selecting 'Properties...' from object's context menu ), select an item using the mouse, and then press CTRL + arrow key to move the selected item to a new position.

I am using the popupmenu editor to create the popup menu at design time. I do not understand how to import images into the editor.  It says to drag the file into the editor but how?

Open an Windows Explorer window and drag icon files, or files that contains icons as internal resource to the images list panel.

I have built a popup menu and I want to attach it to a window, as a menu bar. Is this possible?

Yes. The control provides a method Attach that helps you to attach a menu to a window. When you don't need anymore the menu bar, the Detach method should be called. If you are using the VB environment, make sure that you have the NegociateMenus property of the Form to False. By default it is True. The following sample attaches a menu bar to the form's window:

PopupMenu1.Attach Me.hWnd

Is there any way to change the foreground color for all items?

Please check the ForeColor and BackColor properties. They will help you to customize the general foreground and background color used. If you are trying to change the foreground or background property for a specific item you should look at the "It would be nice to have the ability to mark some items using bold or italic font attribute. Is this possible?". Using the built-in HTML feature you can specify whatever you want for an item.

Is there any way to close the popup menu programmatically?

The control provides a CloseOnClick property. The CloseOnClick property specifies whether the control is closed when the user clicks. If the CloseOnClick property is True, the control will be automatically closed when the user clicks the mouse. If the CloseOnClick property is False, the popup menu is closed when the mouse cursor leaves the client area of the popup menu. The CloseOnClick property should be called at run time, just before ShowAtCursor or Show method.

Can I add new items to the popup while it is visible?

Unfortunately you cannot add new items to the popup menu, while it is shown ( opened ). You can add new items only if the popup menu is not opened. 

How can I set an item so that it appears as not selected?

The Gray and Highlight properties of Item object helps you to specify how the item appear when it is disabled and selected. For instance, the following sample adds an unselectable item:

With PopupMenu1
        With .Items.Add("My <b>title</b>", Default, 1234)
            .Highlight = False
            .Enabled = False
            .Gray = False
        End With
End With

How do I assign a PopupMenu object to a MenuButton object on C#?

Use a syntax like follows:
axMenuButton1.Menu = ( axPopupMenu1.GetOcx() as EXPOPUPMENULib.PopupMenu );

What are the differences between exMenu and exPopupMenu?

The differences between exMenu and exPopupMenu components include:
  • the exPopupMenu displays a shortcut, vertical or context menu, since the exMenu displays a top level menu for a form or dialog.
  • the exPopupMenu uses the system context menu to display items, the exMenu doesn't subclass any window or system menu.
  • only one exPopupMenu can be shown at one time, since a form may display multiple exMenu instances in the same time.
  • the exMenu provides the ability to host ActiveX controls, the exPopup can't display ActiveX inside.
  • the exPopupMenu can be assigned to a button using the MenuButton object, since the exMenu has not such of an option.
  • At runtime, the exPopupMenu is a modal window and can't be a child window of a form or dialog, since the exMenu component is a child of a form or dialog.
  • the exMenu can use accelerator keys, the exPopupMenu doesn't use accelerator keys.
  • and more.

It seems that the Command event is never fired?

The Command event is fired only if the menu is attached to a form using the Attach method. The Command event is never fired if you display the control using the Show or ShowAtCursor properties. Use the Attach method to attach a menu bar to a dialog or a form. The Command event is fired when user clicks or selects an item from the dialog/form's menu bar.