Displays a pop-up menu on an MDIForm or Form object at the current mouse location or at specified coordinates.
Object.PopupMenu ( pMenuPop [,enPopupMenu] [,fX] [,fY] )
The PopupMenu method syntax has the following parts:
Name |
Type |
Description |
Object |
AForm |
AForm object |
pMenuPop |
Val AMenu |
The name of the pop-up menu to be displayed. |
enPopupMenu |
Val enumAFormPopupMenu |
An integer which specifies the location and behavior of a pop-up menu. |
fX |
Val Variant |
The x-coordinate where the pop-up menu is displayed. If omitted, the mouse coordinate is used. |
fY |
Val Variant |
The y-coordinate where the pop-up menu is displayed. If omitted, the mouse coordinate is used. |
enumAFormPopupMenu can be one of the following:
Name |
Value |
Description |
aformPopupMenuLeftAlign |
0 * |
Left Align. The left side of the pop-up menu is located at x. |
aformPopupMenuCenterAlign |
4 |
Center Align. The pop-up menu is centered at x. |
aformPopupMenuRightAlign |
8 |
Right Align. The right side of the pop-up menu is located at x. |
aformPopupMenuLeftButton |
0 |
Left Button. An item on the pop-up menu reacts to a mouse click only when you use the left mouse button. |
aformPopupMenuRightButton |
2 |
Right Button. An item on the pop-up menu reacts to a mouse click when you use either the right or the left mouse button. |
Use the ScaleMode property to specify the unit of measure for the x and y coordinates. The x and y coordinates define where the pop-up is displayed relative to the specified form. If the x and y coordinates are not included, the pop-up menu is displayed at the current location of the mouse pointer.
When a pop-up menu is displayed, the code following the call to the PopupMenu method is not executed until the user either chooses a command from the menu (in which case the code for that command's Click event is executed before the code following the PopupMenu statement) or cancels the menu. In addition, only one pop-up menu can be displayed at a time; therefore, calls to this method are ignored if a pop-up menu is already displayed or if a pull-down menu is open.
The PopupMenu method does not support named arguments.
The following statement will display the Commandshortcut1 menu at the X=20 and Y=30 coordinates (with the units as defined in the ScaleMode property) when the user clicks the left mouse button:
frm1.PopupMenu("Commandshortcut1",0,20,30)