hello,
i have few questions about WinAPI:
1) how can i make the [TAB] key switching between control windows?
2) is there a function to check\uncheck a radio button?
3) how can i set a button which will be pushed when the ENTER was pressed?
hello,
i have few questions about WinAPI:
1) how can i make the [TAB] key switching between control windows?
2) is there a function to check\uncheck a radio button?
3) how can i set a button which will be pushed when the ENTER was pressed?
Well, I would answer all of those with the API, SendMessage.
1) Intercept the message sent by the tab key and then send messages to the appropriate controls to set the focus. You could use an enumerated list for ordering, or you could implemet the resource.h definitions for the controls.
2) Simplest one. Send a message to the button, telling it what to do.
3) Same principle as number 1. Intercept the enter key message, then send a "push the button" message to the button.
I realize I've been very vague, but you can find all of these messages at MSDN.com .
Last edited by Jaken Veina; 06-17-2005 at 11:35 AM.
Code:void function(void) { function(); }
thanks for your help.
1 and 2 are now ok, but i still don't understand how to make a button default for pressing.
i tried giving it the BS_DEFPUSHBUTTON style but it's not working...
Make it default for pressing.....not quite sure what you mean. You mean give it the focus? Well, the BS_DEFPUSHBUTTON should work. Unless you've got others using that style. Otherwise, you should research Messages for giving buttons a focus and just do it yourself.
Code:void function(void) { function(); }
do i need another style except BS_DEFPUSHBUTTON ?
it doesn't work... i press ENTER and nothing happens.
i also tried giving the focus to the button with SetFocus() and when i press ENTER it still doesn't work.
No, no, no. Just because a button has the focus doesn't mean that you can trigger it with Enter. You need to write your own code to say "When I press Enter, trigger the button that has the focus."
Code:void function(void) { function(); }