Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
custom:javascript:lib:ddlightbarmenu.js [2023/04/06 13:02] – Mentioned the fact that DDLightbarMenu can now work in non-lightbar mode if the user's terminal doesn't support ANSI (and has a property, allowANSI, that can be set false if you want to force it to do so). Added a link to DDMsgReader.js at the bottom for Nightfox | 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 | ||
---|---|---|---|
Line 78: | Line 78: | ||
| selectedItemColor | | selectedItemColor | ||
| unselectableItemColor | | unselectableItemColor | ||
- | | itemTextCharHighlightColor | The color of a highlighted non-space character in an item text (specified by having a & in the item text). | + | | itemTextCharHighlightColor | The color of a highlighted non-space character in an item text (specified by having a & in the item text). |
| borderColor | | borderColor | ||
| scrollbarScrollBlockColor | | scrollbarScrollBlockColor | ||
Line 113: | Line 113: | ||
var val = lbMenu.GetVal(); | var val = lbMenu.GetVal(); | ||
// Output the chosen menu item | // Output the chosen menu item | ||
- | console.print(" | + | console.print(" |
console.print(" | console.print(" | ||
console.pause(); | console.pause(); | ||
| | ||
// Changing the normal item color to green & selected item color to bright green: | // Changing the normal item color to green & selected item color to bright green: | ||
- | lbMenu.colors.itemColor = "\1n\1g"; | + | lbMenu.colors.itemColor = "\x01n\x01g"; |
- | lbMenu.colors.selectedItemColor = "\1n\1h\1g"; | + | lbMenu.colors.selectedItemColor = "\x01n\x01h\x01g"; |
| | ||
// Disabling the navigation wrap behavior: | // Disabling the navigation wrap behavior: | ||
Line 156: | Line 156: | ||
lbMenu.borderChars.upperLeft = " | lbMenu.borderChars.upperLeft = " | ||
To set/change any of the border characters, you can also call the SetBorderChars() function and pass an object containing any or all of the above properties to set the border characters in the object. | To set/change any of the border characters, you can also call the SetBorderChars() function and pass an object containing any or all of the above properties to set the border characters in the object. | ||
+ | lbMenu.SetBorderChars({ | ||
+ | left: " | ||
+ | right: " | ||
+ | top: " | ||
+ | bottom: " | ||
+ | upperLeft: "/", | ||
+ | upperRight: " | ||
+ | lowerLeft: " | ||
+ | lowerRight: "/" | ||
+ | }); | ||
+ | |||
+ | Not all border characters need to be specified. | ||
lbMenu.SetBorderChars({ | lbMenu.SetBorderChars({ | ||
left: " | left: " | ||
Line 166: | Line 178: | ||
To change the colors, you can directly change the properties of the color object within the DDLightbarMenu, | To change the colors, you can directly change the properties of the color object within the DDLightbarMenu, | ||
lbMenu.SetColors({ | lbMenu.SetColors({ | ||
- | itemColor: "\1b", | + | itemColor: "\x01b", |
- | selectedItemColor: | + | selectedItemColor: |
}); | }); | ||
Line 178: | Line 190: | ||
For the last item, the ' | For the last item, the ' | ||
For example, for a menu with items that are simply titled "Item 1" and so on, this specifies indexes to color the item text with " | For example, for a menu with items that are simply titled "Item 1" and so on, this specifies indexes to color the item text with " | ||
- | lbMenu.colors.itemColor = [{start: 0, end: 5, attrs: "\1h\1g\1" + " | + | lbMenu.colors.itemColor = [{start: 0, end: 5, attrs: "\x01h\x01g\x01" + " |
- | lbMenu.colors.selectedItemColor = [{start: 0, end: 5, attrs: "\1r\1" + " | + | lbMenu.colors.selectedItemColor = [{start: 0, end: 5, attrs: "\x01r\x01" + " |
====== Replacing the NumItems() and GetItem() functions ====== | ====== Replacing the NumItems() and GetItem() functions ====== | ||
Line 208: | Line 220: | ||
// 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. | ||
- | // | + | // |
- | // | + | // |
return menuItemObj; | return menuItemObj; | ||
}; | }; | ||
Line 223: | Line 235: | ||
else | else | ||
{ | { | ||
- | console.print(" | + | console.print(" |
return false; | return false; | ||
} | } |