Purpose
Returns information about a MapInfo Pro menu item.
Syntax
MenuItemInfoByHandler( handler, attribute )
handler is either a string (containing the name of a handler procedure specified in a Calling clause) or an integer (which was specified as a constant in a Calling clause).
attribute is an integer code indicating which attribute to return; see table below.
Description
The handler parameter can be an integer or a string. If you specify a string (a procedure name), and if two or more menu items call that procedure, MapInfo Pro returns information about the first menu item that calls the procedure. If you need to query multiple menu items that call the same handler procedure, give each menu item an ID number (for example, using the optional ID clause in the Create Menu statement), and call MenuItemInfoByID() function instead of calling MenuitemInfoByHandler().
The attribute parameter is a numeric code (defined in MAPBASIC.DEF) from the following table:
attribute setting | ID | Return value |
---|---|---|
MENUITEM_INFO_ENABLED | 1 | Logical: TRUE if the menu item is enabled. |
MENUITEM_INFO_CHECKED | 2 | Logical: TRUE if the menu item is checkable and currently checked; also return TRUE if the menu item has alternate menu text (for example, if the menu item toggles between Show... and Hide...), and the menu item is in its "show" state. Otherwise, return FALSE. |
MENUITEM_INFO_CHECKABLE | 3 | Logical: TRUE if this menu item is checkable (specified by the "!" prefix in the menu text). |
MENUITEM_INFO_SHOWHIDEABLE | 4 | Logical: TRUE if this menu item has alternate menu text (for example, if the menu item toggles between Show... and Hide...). An item has alternate text if it was created with "!" at the beginning of the menu item text (in a Create Menu statement or Alter Menu statement) and it has a caret (^) in the string. |
MENUITEM_INFO_ACCELERATOR | 5 | String: The code sequence for the menu item's accelerator (for example, "/W^Z" or "/W#%119") or an empty string if the menu item has no accelerator. For details on menu accelerators, see Create Menu statement. |
MENUITEM_INFO_TEXT | 6 | String: the full text used (for example, in a Create Menu statement) to create the menu item. |
MENUITEM_INFO_HELPMSG | 7 | String: the menu item's help message (as specified in the HelpMsg clause in Create Menu statement) or empty string if the menu item has no help message. |
MENUITEM_INFO_HANDLER | 8 | Integer: The menu item's handler number. If the menu item's Calling clause specified a numeric constant (for example, Calling M_FILE_SAVE), this call returns the value of the constant. If the Calling clause specified "OLE", "DDE", or the name of a procedure, this call returns a unique integer (an internal handler number) which can be used in subsequent calls to MenuitemInfoByHandler() or in the Run Menu Command statement. |
MENUITEM_INFO_ID | 9 | Integer: The menu ID number (specified in the optional ID clause in a Create Menu statement), or 0 if the menu item has no ID. |
See Also:
MenuItemInfoByID() function