Click to See Complete Forum and Search --> : Default Ok buttons gets focus automatically!


Shahzad
April 11th, 1999, 07:06 AM
I am working with a dialog box with several edit boxes and buttons. When I start to write something in an edit box, the default 'ok' buttons gets the focus automatically, no matter if I had actually jumbed to the edit box from another button(= other button was in focus). So when I press enter the ok button is always executed. I don't want this to happen.
I have changed the tab order but it is not working. I want focus on my last button from where I jumped into the edit box. Please help!

Paul McKenzie
April 11th, 1999, 12:13 PM
Change the style of the Ok button in your resource file or use the resource editor to change the style. It currently has the DEFPUSHBUTTON style, which is why it automatically gets the focus.

Regards,

Paul McKenzie

Shahzad
April 11th, 1999, 12:47 PM
The problem was grave but the solution easy!
thankx

Thomas Rizos
April 11th, 1999, 01:32 PM
i'm suprised that worked :)
add the OnInitDialog( ); message with the class wizzard
and at the end of the source return FALSE; instead
what it does as default by returning true is to put focus on the first Control in the dialog..