Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Different radio button groupings in the same shell
Different radio button groupings in the same shell [message #451758] Tue, 08 March 2005 16:18 Go to next message
daren is currently offline darenFriend
Messages: 10
Registered: July 2009
Junior Member
I am having problems creating 2 different groups of radio buttons in the
same display. For example, I need to create a group of radio buttons that
allow the user to select which gender(M or F), and a seperate group to
allow the user to select blood type. However, when I create all the radio
buttons in the same page, they appear as one group, in which i can only
select one of them. Can anyone help me on this? Thanks.
Re: Different radio button groupings in the same shell [message #451766 is a reply to message #451758] Tue, 08 March 2005 17:27 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Radio buttons created within the same Composite act as a group. To separate
the buttons into two different groups, create two parent composites:

public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new RowLayout());
Composite c1 = new Composite(shell, SWT.NONE);
c1.setLayout(new RowLayout());
Button b = new Button(c1, SWT.RADIO);
b.setText("M");
b = new Button(c1, SWT.RADIO);
b.setText("F");
Composite c2 = new Composite(shell, SWT.NONE);
c2.setLayout(new RowLayout());
b = new Button(c2, SWT.RADIO);
b.setText("A");
b = new Button(c2, SWT.RADIO);
b.setText("B");
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}

"daren" <darenyeo@hotmail.com> wrote in message
news:d0kj8d$lt3$1@www.eclipse.org...
>I am having problems creating 2 different groups of radio buttons in the
>same display. For example, I need to create a group of radio buttons that
>allow the user to select which gender(M or F), and a seperate group to
>allow the user to select blood type. However, when I create all the radio
>buttons in the same page, they appear as one group, in which i can only
>select one of them. Can anyone help me on this? Thanks.
>
Previous Topic:Browser Widget and <Ctrl> N
Next Topic:Dynamic size composite
Goto Forum:
  


Current Time: Mon May 13 17:22:00 GMT 2024

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

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

Back to the top