How add a control key shortcut and function when key used

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!
Anonymous user
How add a control key shortcut and function when key used

Hi,

I have a panel on my .nsddef file with many checkboxes and I would like a shortcut key (for example "CTRL+0") for uncheck all checkboxes and another shortcut key (for example "CTRL+1") for check all checkboxes.

How I can do that? How capture the shortcut key and where I set the function called when the shortcut key is pressed ?

Thanks for any help that set me on the good road.

Greetings, JL.

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: How add a control key shortcut and function when key used

By setting a shortcut like CTRL+0 you need to tell your users how to use it, i.e. by adding an help label.

IMHO there is a better way:

  • place 2 buttons whith these texts: "Check &all" and "Check &none"
    the & before a character makes that char accessible with the combination ALT+char, so clicking the Check none button or pressing ALT+n shortcut will lead to the same result
  • set the onClick property value of the two buttons to custom functions that check/uncheck all checkboxes
    this function should better stay in your own script and not in .nsdinc generated one

As for the original question, I don't know how to register for an hotkey, but I suppose it requires calling some Win32 API function like RegisterHotKey() and it shouldn't be so easy...
The best place to ask for help on this is the official NSIS forum: http://forums.winamp.com/forumdisplay.php?forumid=65

Anonymous user
Re: How add a control key shortcut and function when key used

Thank you, I use your solution and works like a charm !

Greetings.