PDA

View Full Version : [CLOSED] [2.0 M1] Radio listener



Yukideluxe
20 Apr 2009, 12:39 AM
I'm almost done with the migration from 1.2 to 2.0 and I've made all work okay instead one thing. I know that it is just a milestone but I post this to let you know in case you didn't realize about the problem :)

- Detailed description of the problem:

I've implemented a listener in a Radio Field for the event Change. In 1.2 it works okay but not in 2.0. I've checked the Java Docs to see if I had to make some change in the listener but the 2.0 Java Doc says the same that 1.2 one.

- GXT version: 2.0 M1
- Host mode / web mode / both: Both
- Browser and version: IE7, Firefox 3.0
- Operating System: Windows
- Sample code:

In this example the info display does not appear when I click in the radio.


public class Test implements EntryPoint {

public void onModuleLoad() {

RadioGroup radioGroup = new RadioGroup("option");

Radio download = new Radio();
download.setBoxLabel("Download");
download.setValue(true);

Radio save = new Radio();
save.setBoxLabel("Save");
save.addListener(Events.Change, new Listener<FieldEvent>() {
public void handleEvent(FieldEvent be) {
Info.display("Click" , "Click");
}
});

radioGroup.add(download);
radioGroup.add(save);

RootPanel.get().add(radioGroup);
}
}Also I've tried to add the listener in the RadioGroup class but it does not work, either.


public class Test implements EntryPoint {

public void onModuleLoad() {

RadioGroup radioGroup = new RadioGroup("option");

Radio download = new Radio();
download.setBoxLabel("Download");
download.setValue(true);

Radio save = new Radio();
save.setBoxLabel("Save");

radioGroup.add(download);
radioGroup.add(save);

radioGroup.addListener(Events.Change, new Listener<FieldEvent>() {
public void handleEvent(FieldEvent be) {
Info.display("Click" , "Click");
}
});

RootPanel.get().add(radioGroup);
}
}Thank you!!

sven
21 Apr 2009, 10:47 AM
That was changed to work exactly as other fields. It only fires on blur. You can however fire it on every setvalue vall with setting fireChangeEventOnSetValue to true.

Yukideluxe
21 Apr 2009, 10:44 PM
Works! Thank you! :)