Windows Default Button Observations

Zach Gorman zach at archetypeauction.com
Sun Aug 15 10:38:57 CDT 2004


> Once you remembered the current (possibly inactive) default
> button in DIALOGINFO, this should come for free.  I hope at
> most one button can be default in a dialog...

In Windows, when you click & hold on a button, each button in the dialog
gets sent a WM_GETDLGCODE, presumably to determine whether it is a
DLGC_DEFPUSHBUTTON or a DLGC_UNDEFPUSHBUTTON. Any button that returns
DLGC_DEFPUSHBUTTON is sent a BM_SETSTYLE to make it non-default
(BS_PUSHBUTTON, not BS_DEFPUSHBUTTON).

The main issue here seems to be separation of button code from dialog code.
It would seem that the dialog code should be responsible for sending the
WM_GETDLGCODE messages to the dialog's children, but how is the dialog code
told to do this? The only messages the dialog itself receives in response to
the LBUTTONDOWN on the button are WM_MOUSEACTIVATE, WM_SETCURSOR, and
WM_CTLCOLORBTN. I don't think it is any of these messages that causes the
dialog to start un-defaulting its child buttons.

Zach





More information about the wine-devel mailing list