MenuItemEx |
www.progui.co.uk Top Previous Next |
MenuItemEx() Syntax MenuItemEx(MenuItemID.l, Text$, *NormalImageID, *HotImageID, *DisabledImageID, Submenu.i) Description Adds a menu item to the current MenuTitleEx or PopupMenuEx. MenuItemID specifies the internal ID to be used and will be posted to the parent window's message queue when selected. MenuItemID can also be #ProGUI_Any in which case the returned value will be the new automatically generated MenuItemID. Text$ is displayed as the menu item's text. NormalImageID, HotImageID and DisabledImageID are pointers to image data that are used to display the menu item in the various states. If *DisabledImageID is null then the disabled state image will be rendered automatically based on *NormalImageID and the current theme/style.SetMenuExImageSize must be called previously in order to set the dimensions of the menu item's icon and will default to 16x16 otherwise. In order to make a submenu, simply specify Submenu as the ID or handle of a previously defined PopupMenuEx.
If Text$ contains the ampersand character '&', the preceding letter will be underlined and used as the menu item's keyboard accelerator. For example: "Save &As..." would be displayed as "Save As..." (pressing 'A' on the keyboard would then select this item).
A hot-key can be automatically displayed and created (see HotKey, MenuExAutoHotKeyDisable) at the right of the item by including the dollar character '$' in the parameter Text$. Any text that precedes the '$' will be displayed as the hot-key, for example: "&Save$Ctrl+S" would be displayed in the menu as "Save Ctrl+S" and be automatically right aligned at the right of the menu with any other hot-keys. If you need to display a dollar character, a double dollar character "$$" will display a single dollar character.
Text$ can also contain "escape codes" for altering the appearance of the text such as Bold, Italic, Underline, Strike Through and Colour effects. An escape code begins with the backslash character '\' followed by a single character. Specifying the same escape code again will toggle the effect off (with the exception of '\c' and '\n' escape codes). If you need a backslash to be displayed in the menu item then a double backslash will give you a single backslash. The following table details the currently supported escape codes and gives examples of usage:
|