TIP: Click on subject to list as thread! ANSI
echo: synchronet
to: RAGNAROK
from: NIGHTFOX
date: 2020-02-09 11:24:00
subject: dd_lightbar_menu.js - hot

  Re: dd_lightbar_menu.js - hotkeys
  By: Ragnarok to Nightfox on Sun Feb 09 2020 03:31 am

 Ra> i working on a filebrowser using this library (you can see it in action at
 Ra> my board) i list files, then i can press enter to select files to download
 Ra> or esc to exit, this is fine. 

 Ra> i wan to known if is possible to add another hotkey for select items. (not
 Ra> for each, but all) 

 Ra> Example, press E over the item selected and triger "the edit file"
 Ra> function press D and trigger another function to delete file

 Ra> Similar to a "keypress event" on the item.
 Ra> I need to get the item and the key pressed.
 Ra> Do you think that can be possible to add?

I committed an update to dd_lightbar_menu.js to support this.  You can get the
latest version from CVS.

I added a new function: AddAdditionalSelectItemKeys(), which adds additional
keys that can be used to select any item (in addition to Enter). This function
takes an array, and the keys are case-sensitive.  For example, to add the key E
to select any item (assuming the menu object is lbMenu):
lbMenu.AddAdditionalSelectItemKeys(["E"]);
To make a case-insensitive verison, both the uppercase and lowercase letter
would need to be added, as in the following example for E:
lbMenu.AddAdditionalSelectItemKeys(["E", "e"]);

Also, after showing the menu & getting a value from the user (using the
GetVal() function), the lastUserInput property will have the user's last
keypress.

Nightfox

---
 þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.