|
Re: Different radio button groupings in the same shell [message #451766 is a reply to message #451758] |
Tue, 08 March 2005 17:27 |
Veronika Irvine 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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03573 seconds