1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    3
    Vote Rating
    0
    Tapir0815 is on a distinguished road

      0  

    Default Event problem with TextToolItem

    Event problem with TextToolItem


    Hi ,

    A click (Events.Click) on TextToolItem never invoke handleEvent of Listener. "Toggle Click" (Events.Toggle) works fine.

    What's wrong? Any idee?

    Thanks!


    Code:
            Listener listener = new Listener<BaseEvent>() {
    
                public void handleEvent(BaseEvent baseEvent) {
                    Window.alert(((ButtonEvent) baseEvent).button.getText());
                }
    
            };
    
            final TextToolItem itemExport = new TextToolItem("Export");
            itemExport.setToolTip("Show Export Explorer");
            itemExport.setIconStyle("icon-export");
            itemExport.addListener(Events.Click, listener);
    
            final ToggleToolItem itemSynchronise = new ToggleToolItem("Synchroise");
            itemSynchronise.setToolTip("Toggle Synchronise Explorer");
            itemSynchronise.setIconStyle("icon-synchronise");
            itemSynchronise.addListener(Events.Toggle, listener);
    
            final ToolBar toolBar = new ToolBar();
            toolBar.add(itemExport);
            toolBar.add(new SeparatorToolItem());
            toolBar.add(itemSynchronise);

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    TextToolItem does not fire the Click event, it fires the Select event. Each component should define what events is fires in its javadocs. There is one issue that is being corrected for the next in beta2. TextToolItem wraps a Button and it is the Button that is passed to the listeners in the ButtonEvent.

    So you can do this:
    Code:
        TextToolItem standard = new TextToolItem("Click Me");
        standard.addListener(Events.Select, new Listener<ButtonEvent>() {
          public void handleEvent(ButtonEvent be) {
            System.out.println("bang bang");
          }
        });
    You can also use a SelectionListener:
    Code:
        standard.addSelectionListener(new SelectionListener() {
          public void componentSelected(ComponentEvent ce) {
            System.out.println("i have been selected");
          }
        });

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar