Ah, sorry, a colleague just informs me that it might be not so simple for the event bubbling as I put it. Not all widgets seem to be able to handle events even when you attach listeners to them. So take what I've written with care. Maybe you want to read up on event handling in the manual [1].
T. [1] http://manual.qooxdoo.org/1.6.x/pages/gui_toolkit/ui_interaction.html On 02/13/2012 06:17 PM, thron7 wrote: > > On 02/13/2012 05:53 PM, Phyo Arkar wrote: >> I want to listen the event that fire event from innermost class . >> >> What i do currently is i listen by doing this: >> >> from TableToolBar: >> >> this.fireEvent("reload",handler) >> >> from top class: >> >> this.DashBoard.RightComp.TableComp.TableToolBar.addListener(...) >> >> >> Is there anyway to listen even from top class directly , without >> needing to drill down hierarchically ? > Two things: > > a) qooxdoo events "bubble". Ie. the event will not only be delivered to > the event target (the widget that should "have" the event), but all > enclosing widgets (where you called the .add method on), up to the root > widget, will be delivered this event (unless you "stop" the event in one > of those widgets, that is). So you can register a "reload" listener e.g. > on your top-most container widget, and it will eventually see the same > event. > > b) On the other hand, you want to make sure that you add listeners for > such an event only to widgets that are really interested in it, and can > do something sensible with it. So if your TableToolBar needs to handle > this event, there is no way around attaching a listener to TableToolBar, > as you did in your example. This is independent of *how* you achieve > that, either by adding the listener in the TableToolBar constructor, > adding it in the code that instantiates objects of this class, or over > some nested object references like you did. > > So you know that the event will bubble up the widget hierarchy, and you > need to attach the listener at those widgets that really want to deal > with it. > > T. > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
