Link to home
Start Free TrialLog in
Avatar of stefanr
stefanr

asked on

Programatically controlled CBitmapButton's

I have a non-modal dialog containing several CBitmapButton controls. In the message handlers for the buttons in the dialog I set the button state. First I iterate through all buttons and removes the pushed state by calling SetState(FALSE). Then I set the pressed button by calling SetState(TRUE). It works fine, until the keyboard is touched. When any key is pressed, the state is reset and all buttons are depressed, which I don't expect to happen. No function that programatically changes the state are called. Why does this happen, and how can I fix it?
ASKER CERTIFIED SOLUTION
Avatar of psdavis
psdavis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stefanr
stefanr

ASKER

I found another way by overloading the CBitmapButton's PreTranslateMessage, and returning TRUE without calling the default handler if pMgs->message is WM_KEYDOWN or WM_KEYUP. That is perhaps even easier.
Good for you!