Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Programatically controlled CBitmapButton's

Posted on 1998-10-16
3
Medium Priority
?
317 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

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