Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
custom:javascript:lib:ddlightbarmenu.js [2018/04/05 09:43] – created nightfoxcustom:javascript:lib:ddlightbarmenu.js [2019/05/11 14:11] – Added information about the new menuTitle property, which can be used to specify a title to write in the top border nightfox
Line 1: Line 1:
-====== DDLightbarMenu.js ====== +====== dd_lightbar_menu.js ====== 
-DDLightbarMenu.js is a loadable JavaScript file that provides a lightbar menu class for use in JavaScript scripts for Synchronet.  DDLightbarMenu supports single item selection and multiple item selection.  For one example of how to use DDLightbarMenu, you can look at the code for ''[[howto:door:slyvote]]''.\\+dd_lightbar_menu.js is a loadable JavaScript file that provides a lightbar menu class for use in JavaScript scripts for Synchronet.  The DDLightbarMenu class supports single item selection and multiple item selection.  For one example of how to use DDLightbarMenu, you can look at the code for ''[[howto:door:slyvote]]''.\\
 \\ \\
 The user can navigate the list using the up & down arrows, PageUp, PageDown, Home, and End keys.  The enter key selects an item.  The ESC key will exit the menu and return null.  This menu library requires the use of an ANSI terminal.  By default, this menu library does not display a border around the menu.  If you want this library to draw a border around the menu, you can set the borderEnabled property to true.  Without a border, the menu gains 2 characters of width and 2 lines of height. The user can navigate the list using the up & down arrows, PageUp, PageDown, Home, and End keys.  The enter key selects an item.  The ESC key will exit the menu and return null.  This menu library requires the use of an ANSI terminal.  By default, this menu library does not display a border around the menu.  If you want this library to draw a border around the menu, you can set the borderEnabled property to true.  Without a border, the menu gains 2 characters of width and 2 lines of height.
  
-This script provides a class, DDLightbarMenu.  To create a new DDLightbarMenu object: new DDLightbarMenu(x, y, width, height);+dd_lightbar_menu.js provides a class, DDLightbarMenu.  To create a new DDLightbarMenu object: new DDLightbarMenu(x, y, width, height);
  
 **DDLightbarMenu methods** **DDLightbarMenu methods**
Line 46: Line 46:
 | itemTextCharHighlightColor | The color of a highlighted non-space character in an item text (specified by having a & in the item text).  It's important not to specify a "\1n" in here in case the item text should have a background color. | | itemTextCharHighlightColor | The color of a highlighted non-space character in an item text (specified by having a & in the item text).  It's important not to specify a "\1n" in here in case the item text should have a background color. |
 | borderColor                | The color for the borders (if borders are enabled) | | borderColor                | The color for the borders (if borders are enabled) |
 +| menuTitle                  | The text to write in the top border (if borders are enabled).  This defaults to an empty string.  Synchronet color/attribute codes are supported. |
  
 By default, the menu selection will wrap around to the beginning/end when using the down/up arrows.  That behavior can be disabled by setting the wrapNavigation property to false. By default, the menu selection will wrap around to the beginning/end when using the down/up arrows.  That behavior can be disabled by setting the wrapNavigation property to false.
Line 64: Line 65:
  
 Example usage: Example usage:
-  load("DDLightbarMenu.js");+  load("dd_lightbar_menu.js");
   // Create a menu at position 1, 3 with width 45 and height of 10   // Create a menu at position 1, 3 with width 45 and height of 10
   var lbMenu = new DDLightbarMenu(1, 3, 45, 10);   var lbMenu = new DDLightbarMenu(1, 3, 45, 10);
Line 90: Line 91:
   // long as it's not a space.  For instance, to highlight the "x" in "Exit":   // long as it's not a space.  For instance, to highlight the "x" in "Exit":
   lbMenu.Add("E&xit", -1);   lbMenu.Add("E&xit", -1);
 +  
 +  // To enable borders and set a title to display in the top border:
 +  lbMenu.borderEnabled = true;
 +  lbMenu.menuTitle = "Options";
  
 To enable borders, set the borderEnabled property to true.  Example: To enable borders, set the borderEnabled property to true.  Example: