Reputation: 2359
I was originally thinking this would be extremely easy to do. Google searches returned results for everything but this.
I am trying to have a normal button that I can click, and it stays down, click again, and it rises back up.
I found one function that did what I wanted, but only worked if the button retained focus, click anywhere else and it rises again.
Button_SetState(GetDlgItem(hwnd, IDC_BTN_SLEEPCLICK), TRUE);
Is there any real way to do this? Or am I gonna need to do this kind of thing by hand?
Thanks.
Upvotes: 1
Views: 3919
Reputation: 490603
Create a check box, then set the "push like" property for that check box to true.
Upvotes: 5
Reputation: 57749
The "staying down" and "rising back up" are a matter of how you draw the button.
You could create your own button class by using the Paint and Redraw methods.
Upvotes: 1
Reputation: 52611
You want a checkbox with BS_PUSHLIKE
style. To toggle it programmatically, use Button_SetCheck
Upvotes: 2