bradharding
14th January 2008 11:02 UTC
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.
Anders
14th January 2008 11:35 UTC
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
bradharding
14th January 2008 22:23 UTC
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.
Anders
14th January 2008 23:36 UTC
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
Animaether
15th January 2008 00:27 UTC
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.
bradharding
15th January 2008 05:30 UTC
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.
Anders
15th January 2008 10:55 UTC
I submitted a patch, http://sourceforge.net/tracker/index...49&atid=373087
bradharding
15th January 2008 11:18 UTC
Thanks very much, Anders! :)