Hi Amit,

First of all "stopPropagation" is only supposed to be used in events, 
which bubble up the widget hierarchy, like mouse and key events. Many 
events like property change or selection events don't bubble. 
"changeSelected" is one of those non bubbling events.  Even if it was 
bubbling, "stopPropagation()" would not do what you describe. Even if 
you call it, it will run all event listeners on the current event 
target. Only event target up the widget hierarchy will be skipped. This 
is how "stopPropagation()" works natively in the browser as well.

Quote from the W3C event spec:
<http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-bubbling>

"Any event handler may choose to prevent further event propagation by 
calling the stopPropagation method of the Event interface. If any 
EventListener calls this method, all additional EventListeners on the 
current EventTarget will be triggered but bubbling will cease at that 
level. Only one call to stopPropagation is required to prevent further 
bubbling."


So I think you will implement your own mechanism to prevent other 
listeners from being executed.

Best Fabian


> Hi,
>
> I am using the "changeSelected" event on qx.ui.tabview.TabView.
> Now, when I write e.stopPropagation(); in my event listener function, 
> Firebug gives an error stating :
> Assertion error! Cannot stop propagation on a non bubbling event: 
> changeSelected: Called assertTrue with 'false'
>
> I made my event as a bubbling event as e.setBubbles(true); and then 
> called e.stopPropagation();. Now, I don't get any error but my event 
> lister gets called twice.
>
> My tabview initially has 2 tabs - Actual and dummy. The eventlistener is 
> set on Tabview and the Actual tab is selected by default. When the dummy 
> tab is clicked, my eventlistener checks which tab is clicked (based on 
> page label). If dummy is clicked, it deletes the dummy tab, adds a new 
> tab and then inserts dummy to its end (functionality similar to that in 
> IE7).
>
> If I write e.stopPropagation(), I get the desired functionality but with 
> errors in Firebug. If I don't write e.stopPropagation() or I write 
> e.setBubbles(true); e.stopPropagation();, then on clicking dummy tab, 2 
> tabs get added instead of 1 (ie. eventListener gets called twice), which 
> I don't want.
>
> Here is a snippet of my code :
>
> this._tabView.addListener("changeSelected",this._choosePage,this);    
> //in class constructor
>
> _choosePage: function(e){   //member function
>     var tabView = e.getTarget();
>     var pg = tabView.getSelected();
>            
>     alert(pg.getLabel());
>            
>     if(pg.getLabel()== ""){   //if dummy tab is clicked
>     this._dummytab();    //deleting dummy tab and add a new tab
>     e.setBubbles(true);   //Writing this line prevents the Firebug error 
> but calls the eventListener twice and causes 2 tabs to get added instead 
> of 1
>     e.stopPropagation(); // Writing just this without above line adds 
> just 1 tab (desired) but causes Firebug error
>     
> this._tabView.addListener("changeSelected",this._choosePage,this);    
> //since listener was removed
>                
>    }
> }
>
> _dummytab: function(){
>     
> this._tabView.removeListener("changeSelected",this._choosePage,this);   
> //else tabView.remove() calls the eventListener _choosePage() again
>     this._tabView.remove(targetPage);
>     this._addtab();   //adds a new tab and then dummy tab
> }
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
>   


-- 
Fabian Jakobs
JavaScript Framework Developer

1&1 Internet AG
Brauerstraße 48
76135 Karlsruhe

Amtsgericht Montabaur HRB 6484

Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas 
Gottschlich, Matthias Greve, Robert Hoffmann, Markus Huhn, Oliver Mauss, Achim 
Weiss
Aufsichtsratsvorsitzender: Michael Scheeren


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to