Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Toggle button acting like radio buttons
Toggle button acting like radio buttons [message #448257] Thu, 06 January 2005 14:41 Go to next message
Xavier Méhaut is currently offline Xavier MéhautFriend
Messages: 133
Registered: July 2009
Senior Member
Hello,
I would like to know how we could simply make several toggle buttons
acting like radio buttons, or even having a group of toggle buttons
which they read automatically their state into a common model when an
external event occurs on the group^itself...
regards
Xavier
Re: Toggle button acting like radio buttons [message #448263 is a reply to message #448257] Thu, 06 January 2005 15:55 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Write the code to do this?

Seriously, listen for SWT.Selection on every button. When a button is
selected, go through a list of toggle buttons (possibly queried from the
parent using "getChildren()" then filtered with "control.instanceof Button
&& (control.getStyle() & SWT.TOGGLE) != 0" to get only the toggle buttons.
For any button that is not the one in the callback, use
"setSelection(false)" to turn off the selection in the old button and
"setSelection(true)" to turn it on for the one in the listener ... oh heck,
here's the code ...

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet169.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup

"Xavier Mehaut" <xavier.mehaut@free.fr> wrote in message
news:crjio0$k0b$1@www.eclipse.org...
> Hello,
> I would like to know how we could simply make several toggle buttons
> acting like radio buttons, or even having a group of toggle buttons
> which they read automatically their state into a common model when an
> external event occurs on the group^itself...
> regards
> Xavier
Previous Topic:Bug in CLabel? Centering not working as expected
Next Topic:TableViewer
Goto Forum:
  


Current Time: Fri Apr 26 17:57:42 GMT 2024

Powered by FUDForum. Page generated in 0.03516 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top