Re: dd_lightbar_menu.js - hotkeys
By: Ragnarok to Nightfox on Sun Feb 09 2020 03:31 am
i working on a filebrowser using this library (you can see it in action at my board) i list files, then i can press enter to select files to download or esc to exit, this is fine.
i wan to known if is possible to add another hotkey for select items. (not for each, but all)
Example, press E over the item selected and triger "the edit file" function press D and trigger another function to delete file
Similar to a "keypress event" on the item.
I need to get the item and the key pressed.
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