Archive: Key shortcuts for controls created using nsDialogs


Key shortcuts for controls created using nsDialogs
Hi,

I have been trying to implement a key shortcut for the text of a checkbox control I have created using nsDialogs. This works fine by using an ampersand, eg. "&Open program." My problem is, though, I don't want the underlined character denoting the key shortcut to appear underlined until I press the ALT key, matching what happens with the back, next, finish buttons, and the controls on the standard pages. Can this behaviour be done programatically?

Thanks in advance.

Regards,
Brad.


AFAIK, SPI_GETKEYBOARDCUES(or whatever its called) is system wide.

adding a & to the base example works fine on my machine

http://img265.imageshack.us/img265/7427/kbdcuesoa4.png

edit: works the same with checkboxes aswell


Thanks for your response, Anders!

On further testing, I've found that it is not the text on checkbox controls that's the problem, but the text on link controls.
Changing the "hello" label in the example you've tested to a link control and changing the text to "&hello" produces what I've described. Any ideas?

Thanks again,
Brad.


the link control is a custom control, if you really feel this simple bug is important you can file a feature request or bug report

i would guess the control would need to send the WM_QUERYUISTATE message to get the initial state, then listen for WM_CHANGEUISTATE messages


as a work-around..
you could create a button that listens to whatever key you're looking for (using aforementioned approach), hide that (off-dialog or using ShowWindow etc., and have that button's event call the same function the link would when clicked.


Thanks for your help, both of you!

As trivial as this little bug is, I have invested a lot of time and effort into the installer, perfecting every little aspect of it, (and the thing it installs), so I would like to see this fixed.

I'll submit a bug report in a little while...

Brad.


I submitted a patch, http://sourceforge.net/tracker/index...49&atid=373087


Thanks very much, Anders! :)