Skip to content

Commit

Permalink
Take care of selection of radio buttons too
Browse files Browse the repository at this point in the history
  • Loading branch information
samuell committed Aug 22, 2011
1 parent f315210 commit d873add
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -154,12 +154,13 @@ private void createRadioButtonsForParam(Parameter parameter, int i) {
radioGroup.setLayoutData(layoutData);

for (String optionValue : selectOptions) {

Button btn = new Button(radioGroup, SWT.RADIO);
btn.setText(optionValue);
// Event handling stuff
btn.addListener(SWT.Selection, this);
btn.addListener(SWT.MouseUp, this);
btn.setData(parameter);
widgets.add(btn);
}
}

Expand Down Expand Up @@ -309,7 +310,7 @@ public void widgetSelected(SelectionEvent e) {

@Override
public void handleEvent(Event event) {
if (event.type == SWT.Selection || event.type == SWT.KeyUp) {
if (event.type == SWT.Selection || event.type == SWT.KeyUp || event.type == SWT.MouseUp) {
String tempCommand = currentTool.getCompleteCommand();
for (Widget widget : this.widgets) {
// Get the new value from the widget
Expand All @@ -318,6 +319,8 @@ public void handleEvent(Event event) {
newValue = ((Combo) widget).getText();
} else if (widget instanceof Text) {
newValue = ((Text) widget).getText();
} else if (widget instanceof Button && ((Button) widget).getSelection()) {
newValue = ((Button) widget).getText();
} else {
System.out.println("Could not set newValue");
}
Expand Down

0 comments on commit d873add

Please sign in to comment.