4D v16.3Pop up menu |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
Pop up menu
Pop up menu
The Pop up menu command displays a pop-up menu at the current location of the mouse. In order to follow user interface rules, you usually call this command in response to a mouse click and if the mouse button is still down. You define the items of the pop-up menu with the parameter contents as follows:
Tip: It is possible to disable the mechanism for interpreting special characters (!, /, etc.) in the pop up menu in order, for example, to have these characters included in the wording. To do this, simply have the contents parameter begin with the statement Char(1) then use this statement as a separator: contents:=Char(1)+"1/4"+Char(1)+"1/2"+Char(1)+"3/4") Note that once this statement has been executed, it is no longer possible to assign styles or shortcuts to the pop up menu. The optional default parameter specifies the default menu item selected when the pop-up menu is displayed. Pass a value between 1 and the number of menu items. If you omit this parameter, the command selects the first menu item as the default. The optional xCoord and yCoord parameters designate the location of the pop-up menu to be displayed. In xCoord and yCoord, pass respectively the horizontal and vertical coordinates of the upper left corner of the menu. These coordinates must be expressed in pixels in the local coordinate system of the current form. These two parameters must be passed together; if only one is passed, it will be ignored. If you use the xCoord and yCoord parameters, the default parameter is ignored. In this case, the mouse is not necessarily located at the level of the pop-up menu. These parameters are particularly useful for managing 3D buttons with an associated pop-up menu. If you select a menu item, the command returns its number; otherwise, it returns zero (0). Note: Use pop-up menus that have a reasonable number of items. If you want to display more than 50 items, you might think about a using scrollable area in a form instead of a pop-up menu. The project method MY SPEED MENU pulls down a navigation speed menu:
// MY SPEED MENU project method This project method can be called from:
In the last two cases, the click does not need to occur in any form object. This is one of the advantages of the Pop up menu command. Generally, you use form objects to display pop-up menus. Using Pop up menu, you can display the menu anywhere. The pop-up menu is displayed on Windows by pressing the right mouse button; it is displayed on Macintosh by pressing Control-Click. Note, however, that the method does not actually check whether or not there was a mouse click; the caller method tests that. The following is the pop-up menu as it appears on Windows (left) and Macintosh (right). Note the standard check mark for the Windows version.
See also
|
PROPERTIES
Product: 4D
HISTORY
Modified: 4D 2004 ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||