Solved

Programatically controlled CBitmapButton's

Posted on 1998-10-16
3
306 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 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