Changing Dialog Default Button
Posted on 1998-11-28
I have a dialog with 2 buttons (plus many other controls), each with a CButton bound to it (m_btnOK and m_btnAND).
Depending on what the user has done so far, I want to change the default button (the one with the thick border which also accepts Enter).
I have tried :-
if ( bOK )
m_btnAND.SetButtonStyle( BS_PUSHBUTTON ) ;
m_btnOK.SetButtonStyle( BS_DEFPUSHBUTTON ) ;
m_btnOK.SetButtonStyle( BS_PUSHBUTTON ) ;
m_btnAND.SetButtonStyle( BS_DEFPUSHBUTTON ) ;
This shifts the thick border around, but the AND button can never be "pressed" by hitting Enter. Therefore it doesn't work to my satisfaction (and this is what I need to fix).
If it makes any difference, the m_btnOK is the OK button, and m_btnAND is just some other button I added to the dialog.
Any hints ???
I seem to remember a Tech Note or something explaining how to change the default button, but I can't find it.