954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Push-button basic question

Hello,

This is a general question, so, I don't think code is necessary.
I have a basic question about buttons in Win32 API... (Solution in MFC is also OK!).

I was doing some experiments in push buttons, using MFC... I can enable/disable a button as I wish, but, there is one thing I can't do and I am not able find how is the action "termed". So I will explain it :
From, a user's point of view, if I am going through settings of an application, there are various buttons and if I want to enable a setting, I click a button. The button stays Pushed. One more example is, If you are on XP and click on Start button, the button stays pushed until you click somewhere else or close the Start Menu...

So, is there anyway we can do this except do a bitmap button ourselves and define statuses?

I hope I am clear in my question...

Thanks in Advance

Creator07
Light Poster
40 posts since Nov 2008
Reputation Points: 10
Solved Threads: 2
 

Maybe you should use a check button. Or search t hese links for something similar to what you are looking for. codeproject.com has a wealth of MFC and other code.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

I had searched in codeproject before, but, not in detail... Anyway, thanks for the answer. I am hoping for some more answers, while I go on searching some more...

Creator07
Light Poster
40 posts since Nov 2008
Reputation Points: 10
Solved Threads: 2
 

Class CButton's create method takes button style argument - MSDN Reference

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This is something similar to what you want -- not exactly but in the ballpark. The button image changes when you hover the mouse over it, so you should be able to change the behavior to make the image stay in place after clicking it.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 
Class CButton's create method takes button style argument - MSDN Reference

Well, thank you... I had a learning of all the kinds of button styles, but, nonetheless, there is none which I want. The BS_PUSHLIKE unfortunately, does not support push buttons :( This is something similar to what you want -- not exactly but in the ballpark. The button image changes when you hover the mouse over it, so you should be able to change the behavior to make the image stay in place after clicking it.

Well, thank ya dragon, but, I had figured out doing such a button with bitmaps earlier, but, I was searching for a inbuilt mechanism so that we do not have to generate bitmap buttons for all languages in my project...

Creator07
Light Poster
40 posts since Nov 2008
Reputation Points: 10
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You