Click to See Complete Forum and Search --> : Changing the DEFPUSHBUTTON...


WhorlyWhelk
June 30th, 2007, 05:58 AM
I got a bunch of buttons in a dialog box (my main window) and when one is entered I want to change the DEFPUSHBUTTON to a different one.

I tried to do this:
SendMessage(log,BM_SETSTYLE,BS_PUSHBUTTON|BS_TEXT|WS_CHILD|WS_TABSTOP,TRUE);
SendMessage(play,BM_SETSTYLE,BS_DEFPUSHBUTTON|BS_TEXT|WS_CHILD|WS_TABSTOP,TRUE);
And when it draws them like the DEFPUSHBUTTON style has swapped, but when I hit enter it still submits the former one rather than the new DEFPUSHBUTTON and they draw the other way!

Is it possible to swap these?

Notsosuperhero
June 30th, 2007, 01:07 PM
Did you try using SetWindowLongPtr (http://msdn2.microsoft.com/en-us/library/ms644898.aspx) with GWL_STYLE?

VladimirF
June 30th, 2007, 02:15 PM
...And when it draws them like the DEFPUSHBUTTON style has swapped, but when I hit enter it still submits the former one rather than the new DEFPUSHBUTTON and they draw the other way!

Well, this is just amazing!
I typed "BS_DEFPUSHBUTTON" into Goggle search, and the very first entry pointed to this CodeGuru forum's thread (http://www.google.com/search?hl=en&q=BS_DEFPUSHBUTTON)
Even more surprizing, there are *my* posts in that old (2001) thread!
See if it will help.

WhorlyWhelk
June 30th, 2007, 04:10 PM
Thanks that worked. ^^