Both sides previous revisionPrevious revisionNext revision | Previous revision |
custom:javascript:lib:ddlightbarmenu.js [2023/10/07 14:50] – Added notes for the functions AddAdditionalQuitKeys(), ClearAdditionalQuitKeys(), and the upcoming new functions AddAdditionalPageUpKeys, ClearAdditionalPageUpKeys, AddAdditionalPageDownKeys, ClearAdditionalPageDownKeys, AddAdditionalFirstPageKeys, ClearA Nightfox | custom:javascript:lib:ddlightbarmenu.js [2024/02/12 18:42] (current) – [Replacing the NumItems() and GetItem() functions] Mention textIsUTF8 nightfox |
---|
**DDLightbarMenu methods** | **DDLightbarMenu methods** |
^ Name ^ Returns ^ Usage ^ Description^ | ^ Name ^ Returns ^ Usage ^ Description^ |
| Add | void | DDLightbarMenu.Add(text, retval, hotkey, selectable) | Adds an item to the menu with a given item text, return value, and hotkey for the item. If the ampersandHotkeysInItems property is set to true before this method is called, then a & can be used in the item text just before the hotkey you want to enable for the item. For example, "Item &1" would display the text "Item 1" with "1" being the hotkey for the item. The 3rd parameter, selectable, is an optional boolean that specifies whether or not the item is selectable. Non-selectable items will be skipped when scrolling through the menu. | | | Add | void | DDLightbarMenu.Add(text, retval, hotkey, selectable, isUTF8) | Adds an item to the menu with a given item text, return value, and hotkey for the item. The isUTF8 parameter specifies whether the item text is UTF-8 (if so, then it will be displayed with the P_UTF8 mode bit to look correct on UTF-8 capable terminals, or converted to cp437 for non-UTF-8 terminals). If the ampersandHotkeysInItems property is set to true before this method is called, then a & can be used in the item text just before the hotkey you want to enable for the item. For example, "Item &1" would display the text "Item 1" with "1" being the hotkey for the item. The 3rd parameter, selectable, is an optional boolean that specifies whether or not the item is selectable. Non-selectable items will be skipped when scrolling through the menu. | |
| Remove | void | DDLightbarMenu.Remove(idx) | Removes an item from the menu by its index | | | Remove | void | DDLightbarMenu.Remove(idx) | Removes an item from the menu by its index | |
| RemoveAllItems | void | DDLightbarMenu.RemoveAllItems() | Removes all items from the menu | | | RemoveAllItems | void | DDLightbarMenu.RemoveAllItems() | Removes all items from the menu | |
// object). To do so, uncomment the line below. | // object). To do so, uncomment the line below. |
//menuItemObj.useAltColors = true; | //menuItemObj.useAltColors = true; |
| |
// You might also opt to give this item specific colors for normal and highlighted | // You might also opt to give this item specific colors for normal and highlighted |
// if you want to make this item appear different for whatever reason. | // if you want to make this item appear different for whatever reason. |
//menuItemObj.itemColor = "\x01r"; // Red | //menuItemObj.itemColor = "\x01r"; // Red |
//menuItemObj.itemSelectedColor = "\x01r\x01" + "7"; // Red with grey background | //menuItemObj.itemSelectedColor = "\x01r\x01" + "7"; // Red with grey background |
| |
| // If you know the text is in UTF-8 format, you must specify so as follows: |
| menuItemObj.textIsUTF8 = true; |
| |
return menuItemObj; // The DDLightbarMenu object will use this when displaying the menu | return menuItemObj; // The DDLightbarMenu object will use this when displaying the menu |
}; | }; |