This topic is locked

Guide 90 – Using HotKeys in PHPRunner

12/28/2024 3:11:57 PM
PHPRunner Tips and Tricks
fhumanes author

img alt
Alan, in his development, requires setting actions when a key combination is pressed. He provided me with the article as a reference: https://asprunner.com/forums/topic/28756-Keyboard-Shortcuts-for-your-application which described the solution very well, however I had problems locating the JavaScript library and there was no complete example.

Searching, I found this solution https://raw.githack.com/jaywcjlove/hotkeys/b3cb4a3/index.html , which is mainly explained for REACT (I found the same with other libraries), but which also has its version for WEB [https://unpkg.com/browse/ hotkeys-js@3.13.9 /dist/ ](https://unpkg.com/browse/ hotkeys-js@3.13.9 /dist/ ).

Objetive

Incorporate HotKeys functionality into PHPRunner developments, with a single configuration for the entire project.

DEMO: https://fhumanes.com/hotkeys/

// JavaScript file customization example for programming the "Hotkey" keys from the browser
hotkeys('ctrl+a,ctrl+b,ctrl+alt+t,ctrl+alt+v,ctrl+alt+s', function (event, handler){
switch (handler.key) {
case 'ctrl+a': alert('you pressed ctrl+a!');
break;
case 'ctrl+b': alert('you pressed ctrl+b!');
break;
case 'ctrl+alt+t': location.href = 'tabla_list.php';
break;
case 'ctrl+alt+v': location.href = 'view_list.php';
break;
case 'ctrl+alt+s': $('a[id^="saveButton"]').click(); // This JQUERY button SAVE
break;
default: alert(event);
}
});

If you are interested in this solution, please access the article at this link.

A
asawyer13DevClub member 12/28/2024

Yes it works perfectly.

Alan

C
Chris Whitehead 12/30/2024

fhumanes , great find on the script, makes dropping hot keys in a simple solution.