Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » ButtonOption is a cute little Toggle button
ButtonOption is a cute little Toggle button [message #24931] Fri, 05 February 2010 04:03 Go to next message
alendar is currently offline  alendar
Messages: 47
Registered: January 2010
Location: Idaho, USA
Member
Anyone else try this? It's not in the layout manager as a widget or control, unless I missed it. No ones used it in the examples or the bazaar. I found one use in the ide, thank goodness.

Its a simple command button that behaves like an Option box, except its a command button. It doesn't take text, you have to set an image programmatically, or I guess you could chain it on the ITEM line in the .lay file.

It's very nifty. The only way I could get it into the layout was by editing the text of the layout instead of the GUI editor, though I probably could have used the User Class option? Doh!

But the text is very easy to edit.

For anyone newer than me:

LAYOUT(MainLayout, 304, 120)
ITEM(ButtonOption, playOrPause, LeftPosZ(48, 40).TopPosZ(4, 15))
END_LAYOUT

Then in a constructor you zap an image on it.

playOrPause = MyImages::play();

Will peek back in textprop.cpp to see how to capture the click event.


cd7651feeb698f6ac6cec1f6deda5e5b
Re: ButtonOption is a cute little Toggle button [message #24934 is a reply to message #24931] Fri, 05 February 2010 08:52 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hi Alendar

Could you put a picture of the control ?


Best regards
IƱaki
Re: ButtonOption is a cute little Toggle button [message #24936 is a reply to message #24934] Fri, 05 February 2010 09:22 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Hi alendar,

ButtonOption is a full featured widget that behaves pretty much the way you described it and it does have text. It is not a secret because it is not in the right click list in the layout editor.

A lot of widgets can only be accessed by editing the class field in the editor. This is less than optimal though Smile.

Right now I consider it almost deprecated and use ToolButton instead, but that doesn't mean that ButtonOption does not do its job right. ToolButton is meant for ToolBars, but it works well anywhere. If you choose to use ButtonOption, you can set the text with SetLabel. It is simpler than ToolButton, and might be the right thing for your needs. You can also set the style to flat with StyleFlat(), and you will get a quite popular flat two state button which appears in a lot of applications.
Re: ButtonOption is a cute little Toggle button [message #24984 is a reply to message #24936] Sat, 06 February 2010 21:29 Go to previous messageGo to next message
alendar is currently offline  alendar
Messages: 47
Registered: January 2010
Location: Idaho, USA
Member
Thanks! I didn't see ToolButton. I'll try it. ButtonOption is good.index.php?t=getfile&id=2228&private=0

The middle button is a the ButtonOption. I like it because the code is so sparse.

The "=" must be overloaded twice.

When I say "playButton = true", it changes to a depressed state.


cd7651feeb698f6ac6cec1f6deda5e5b
Re: ButtonOption is a cute little Toggle button [message #24985 is a reply to message #24934] Sat, 06 February 2010 21:42 Go to previous message
alendar is currently offline  alendar
Messages: 47
Registered: January 2010
Location: Idaho, USA
Member
Here's some different views. I like the ButtonOption so far because it seems to maintain look and feel and behavior with the Button object.

index.php?t=getfile&id=2230&private=0

I didn't show hover over the depressed button since it doesn't change, but perhaps I should have.


cd7651feeb698f6ac6cec1f6deda5e5b
Previous Topic: Menus and Toolbars
Next Topic: v.1952 errors
Goto Forum:
  


Current Time: Fri Mar 29 08:14:33 CET 2024

Total time taken to generate the page: 0.01159 seconds