Solved

Programatically controlled CBitmapButton's

Posted on 1998-10-16
3
299 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:stefanr
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
psdavis earned 100 total points
ID: 1323390
Your easiest solution is to copy the CBitmapButton code into your project (it's relatively small) and override the mechanism for loading and displaying the images.  Then instead of doing the SetState functions, create yourself a new function that will replace the 'Up' bitmap with the 'Down' bitmap.

Phillip
0
 
LVL 3

Author Comment

by:stefanr
ID: 1323391
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.
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1323392
Good for you!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now