| Summary: | setSelection for radio button does not work | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Keith Willenson <keith> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | eclipse.felipe, remy.suen, shiluka |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
works for me:
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
int radiusRounding = 2;
for (int i = 0; i <= 3; i++) {
String value = "Button " + Integer.toString(i);
Button b = new Button(shell, SWT.RADIO);
b.setText(value);
b.setSelection(i == radiusRounding);
}
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
display.dispose();
}
can you please try this above?
I running SWT from head:
http://eclipse.org/swt/cvs.php
it works on linux and windows
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Button b1 = new Button(shell, SWT.RADIO);
b1.setText("button_1");
Button b2 = new Button(shell, SWT.RADIO);
b2.setText("button_2");
Button b3 = new Button(shell, SWT.RADIO);
b3.setText("button_3");
b2.setSelection(true);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
it works on linux and windows
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Button b1 = new Button(shell, SWT.RADIO);
b1.setText("button_1");
Button b2 = new Button(shell, SWT.RADIO);
b2.setText("button_2");
Button b3 = new Button(shell, SWT.RADIO);
b3.setText("button_3");
b2.setSelection(true);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
what is the OS you used ?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: I20110613-1736 No matter which radio button has setSelection(true), the first button always is selected. Reproducible: Always Steps to Reproduce: int radiusRounding = 2; for (int i=0;i<=3;i++) { String value = "Button " + Integer.toString(i); Button b = new Button(entryComp, SWT.RADIO); b.setText(value); b.setSelection(i == radiusRounding); }