How add a control key shortcut and function when key used

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: 1125
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.

warning

Warning, JavaScript is disabled!

JavaScript is not available, maybe because you disabled it globally into your browser settings or you are using an addon like NoScript.

We do not have any dangerous JavaScript running here.
Please enable JavaScript; if you're using NoScript this image will help you adding CoolSoft to your whitelist.

Thanks for your comprehension and enjoy CoolSoft.