1:
|
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.
|
2:
|
The control provides two properties: Show and ShowAtCursor. The Show property requires the x and y coordinates at which the popup menu is displayed, while ShowAtCursor displays the menu at the current cursor position without requiring any additional parameters. Both properties return the identifier of the selected item. The Command property can be used to retrieve the selected item's command.
The following VB sample shows how to display the popup menu at the current mouse cursor position:
Dim i As Long
i = PopupMenu1.ShowAtCursor()
|
3:
|
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
|
4:
|
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.
|
5:
|
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.
|
6:
|
Yes. The control's library provides a MenuButton object that helps you to attach a popup menu to a command button.
The following VB sample shows how to attach a popup menu to a command button:
Set MenuButton1.Menu = PopupMenu1
The menu button's caption is not automatically updated when the user selects a new item from the popup menu.
The following VB sample shows how to handle the click event of the command button:
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.
|
7:
|
The control supports built-in HTML format in item's caption, which allows you to specify bold, italic, underline, strikeout, foreground and background color for an item.
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 VB sample shows how to set the caption of an item using bold font attribute:
PopupMenu1.Command(1).Caption = "<b>" & PopupMenu1.Command(1).Caption & "</b>"
|
8:
|
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.
|
9:
|
Open an Windows Explorer window and drag icon files, or files that contains
icons as internal resource to the images list panel.
|
10:
|
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
|
11:
|
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.
|
12:
|
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.
|
13:
|
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.
|
14:
|
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
|
15:
|
The control's library provides a MenuButton object that helps you to attach a popup menu to a command button.
The following C# sample shows how to assign a PopupMenu object to a MenuButton object:
axMenuButton1.Menu = ( axPopupMenu1.GetOcx() as EXPOPUPMENULib.PopupMenu );
|
16:
|
The ExMenu control is a menu control that displays a top-level menu for a form or dialog, while the ExPopupMenu control is a popup menu control that displays shortcut, vertical, or context menus. The ExMenu control does not subclass any window or system menu, while the ExPopupMenu control uses the system context menu to display its items.
The main differences between the ExMenu and ExPopupMenu components are:
- The ExPopupMenu displays shortcut, vertical, or context menus, while the ExMenu displays a top-level menu for a form or dialog.
- The ExPopupMenu uses the system context menu to display its items, while the ExMenu does not subclass any window or system menu.
- Only one ExPopupMenu instance can be displayed at a time, whereas a form can display multiple ExMenu instances simultaneously.
- The ExMenu can host ActiveX controls, while the ExPopupMenu cannot display ActiveX controls.
- The ExPopupMenu can be assigned to a button using the MenuButton object, whereas the ExMenu does not provide this functionality.
- At runtime, the ExPopupMenu is a modal window and cannot be a child window of a form or dialog, whereas the ExMenu is a child of its parent form or dialog.
- The ExMenu supports accelerator keys, while the ExPopupMenu does not.
- And more.
|
17:
|
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.
|