Both sides previous revisionPrevious revisionNext revision | Previous revision |
custom:javascript:lib:ddlightbarmenu.js [2023/06/30 09:36] – Additional notes about SetBorderChars(); changed the control char in the attributes from \1 to \x01 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 | |
| ScreenRowForItem | number | DDLightbarMenu.ScreenRowForItem(itemIdx) | Returns the screen row number (in absolute screen coordinates) of an item on the menu, if it is visible. If the item is not visible, this will return -1. | | | ScreenRowForItem | number | DDLightbarMenu.ScreenRowForItem(itemIdx) | Returns the screen row number (in absolute screen coordinates) of an item on the menu, if it is visible. If the item is not visible, this will return -1. | |
| ToggleItemSelectable | void | DDLightbarMenu.ToggleItemSelectable(itemIdx, selectable) | Toggles whether an item should be selectable. Parameters are the item index and a boolean specifying whether the item should be selectable. | | | ToggleItemSelectable | void | DDLightbarMenu.ToggleItemSelectable(itemIdx, selectable) | Toggles whether an item should be selectable. Parameters are the item index and a boolean specifying whether the item should be selectable. | |
| | AddAdditionalQuitKeys | void | DDLightbarMenu.AddAdditionalPageUpKeys(additionalKeysStr) | Adds a list of keys to use as quit keys in addition to ESC. additionalKeysStr is a string | |
| | ClearAdditionalQuitKeys | void | DDLightbarMenu.ClearAdditionalQuitKeys() | Clears the list of additional quit keys | |
| | AddAdditionalPageUpKeys | void | DDLightbarMenu.AddAdditionalPageUpKeys(additionalKeysStr) | Adds a list of keys to use as page-up keys in addition to PageUp. additionalKeysStr is a string | |
| | ClearAdditionalPageUpKeys | void | DDLightbarMenu.ClearAdditionalPageUpKeys() | Clears the list of additional page-up keys | |
| | AddAdditionalPageDownKeys | void | DDLightbarMenu.AddAdditionalPageDownKeys(additionalKeysStr) | Adds a list of keys to use as page-down keys in addition to PageDown. additionalKeysStr is a string | |
| | ClearAdditionalPageDownKeys | void | DDLightbarMenu.ClearAdditionalPageDownKeys() | Clears the list of additional page-down keys | |
| | AddAdditionalFirstPageKeys | void | DDLightbarMenu.AddAdditionalFirstPageKeys(additionalKeysStr) | Adds a list of keys to use as additional first-page keys in addition to HOME. additionalKeysStr is a string | |
| | ClearAdditionalFirstPageKeys | void | DDLightbarMenu.ClearAdditionalFirstPageKeys() | Clears the list of additional first-page keys | |
| | AddAdditionalLastPageKeys | void | DDLightbarMenu.AddAdditionalLastPageKeys(additionalKeysStr) | Adds a list of keys to use as additional last-page keys in addition to END. additionalKeysStr is a string | |
| | ClearAdditionalLastPageKeys | void | DDLightbarMenu.ClearAdditionalLastPageKeys() | Clears the list of additional last-page keys | |
| |
**DDLightbarMenu properties** | **DDLightbarMenu properties** |
// 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 |
}; | }; |