Solved

Programatically controlled CBitmapButton's

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 87
Generic progress indicator 6 117
Looking for a specific application/software 2 115
viewing source code from eclipse 13 110
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 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