Jump to content
  • Advertisement
Sign in to follow this  
Coluna

Creating BitButtons - MFC

This topic is 4578 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello; I wanna put lightgroups buttons in my engine editor. It should be something like the smoothing groups buttons on 3d Max, where when u click, the buttons remains pushed until u click again...im not meaning checkboxes, where the text is placed on right of the button...can anybody helps me?

Share this post


Link to post
Share on other sites
Advertisement
Coluna,

What API are you using? As most people on these forums are using MFC or .NET, I'll assume that's what you're using.

MFC:
To get the behavior you're looking for, just create a checkbox control but pass it the 'BS_PUSHLIKE' button style as a parameter in the create function. By doing this, it will behave like a checkbox (on/off state) but will LOOK like a regular button.

// Use code something like the following
CButton myButton;
myButton.Create( "", BS_CHECKBOX | BS_PUSHLIKE, rect, pParent, myID );

.NET
To get the behavior you're looking for just create a checkbox object, and set its appearance property to 'Button'

C# example:
// Create and initialize a CheckBox.
CheckBox checkBox1 = new CheckBox();

// Make the check box control appear as a toggle button.
checkBox1.Appearance = Appearance.Button;

// Turn off the update of the display on the click of the control.
// This means you'll have to manually control the check state in the
// OnClick handler
checkBox1.AutoCheck = false;

Cheers and Good luck!

Share this post


Link to post
Share on other sites
Yes, im using MFC (as in title hehehe)...but the problem is that i dont have the explicit myButton.Create(...) call...even if i call myButton.SetButtonstyle(BS_CHECKBOX | BS_PUSHLIKE), it doesnt work...maybe i should overload some method of my dialog (my buttons r inside a dialog), but i couldnt find witch one and the right way...but thanks anyway

Share this post


Link to post
Share on other sites
Ahhh forget it...its just set "Push Like" true in the properties tab....see ya

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!