0

I'm not sure if we are just 20 people in the world using dart right now and maybe just 10% of us try to use widgets..anyway, I seem not to understand if I'm doing something wrong with DWT or there is a bug. Here is a very simple example. I don't understand why the event are not even fired.

void main() {
    ui.HorizontalPanel panel = new ui.HorizontalPanel();
    ui.ToggleButton t1;
    t1= new ui.ToggleButton.fromText("click",handler: new event.ClickHandlerAdapter((event.ClickEvent e) {
  hans(panel,t1);
    } ));
    ui.ToggleButton t3;
    t3 = new ui.ToggleButton.fromText("click");
    t3.addClickHandler(new event.ClickHandlerAdapter((event.ClickEvent event) {
     window.alert("Stop poking me!");
    }));
    panel.add(t1);
    panel.add(t3);
    ui.RootLayoutPanel.get().add(panel);
}
void hans(ui.Panel panel,ui.ToggleButton button){
    var iter = panel.iterator();
    while (iter.moveNext()) {
    var butt = iter.current;
    if (butt is ui.ToggleButton){
      if (butt != button) {
        butt.setDown(true);
      }
    }
}
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
maugch
  • 1,276
  • 3
  • 22
  • 46

1 Answers1

0

Not really an answer to your question, but something I've noticed:

Not sure if bug or by design, but seems like the first node of a Tree does not handle clicks properly. I've created a tree with two ui.Label(s) in it and the first ui.Label does not respond to clicks. No aparent reason for that.

If I insert these ui.Label(s) in reversed order the situation is still the same: the first ui.Label (the other ui.Label, this time) does not respond to clicks.

So, I've circumvented the trouble by adding a Label in the beginning as "/" which is absolutely useless but does not need to respond to any clicks anyway.

Richard Gomes
  • 5,675
  • 2
  • 44
  • 50