sietschie
sietschie

Reputation: 7553

CButton gets send WM_SETSTYLE to BS_DEFPUSHBUTTON Message when clicked

I have several CButton objects. When I click them, they get send a WM_SETSTYLE message changing the style from BS_PUSHBUTTON to BS_DEFPUSHBUTTON. This change is permanent and does not go away when I push another button.

CButton* button = new CButton;
button->Create(L"button", WS_CHILD | WS_VISIBLE , CRect( 10,10,100,100), this, IDC_BUTTON);

What could cause that behaviour?

For testing purposes I created a new project from scratch. There the buttons don't get changed. But I am not able to figure out, what I do differently.

Upvotes: 0

Views: 401

Answers (1)

xMRi
xMRi

Reputation: 15375

In a Dialog or a window with child windows this states are handled by WM_NEXTDLGCTL respective CWnd::GotoDlgCtrl and CWNd::NextDlgCtrl/PrevDlgCtrl

You should never use SetFocus in a Dialog when Buttons are involved.

Upvotes: 1

Related Questions