Hi skar, On Monday 19 October 2009 skar wrote: > > qooxdoo offers a FocusHandler for all widgets. You can ask this > > FocusHandler for the currently active and focused widget. > > > > --snip-- > > var activeWidget = > > qx.ui.core.FocusHandler.getInstance().getActiveWidget(); var focuseWidget > > = qx.ui.core.FocusHandler.getInstance().getFocusedWidget(); --snip-- > > > > See http://demo.qooxdoo.org/current/apiviewer/#qx.ui.core.FocusHandler > > for more details. > > I tried this in the playground, but it didn't work. Any ideas? I've just tried it myself in the playground and the FocusHandler returned me the current focused widget (in the case of the code below this has to be the button).
> > var layout = new qx.ui.layout.VBox; > > var child_container = new qx.ui.container.Composite(); > > child_container.setLayout(layout); > > > > this.getRoot().add(child_container); > > var bt1 = new qx.ui.form.Button("Focus"); > > var field = new qx.ui.form.TextField(); > > child_container.add(bt1); > > child_container.add(field); > > bt1.addListener("execute",function(){ > > field.focus(); > > var focusedWidget = > > qx.ui.core.FocusHandler.getInstance().getFocusedWidget(); > > field.setValue(focusedWidget); > > },this); > > I'm getting focusedWidget to be null, but I can see the focus in the > text field. The problem here is that the focussing is done asynchron inside the qooxdoo element queue. If you change your event listener code to --snip-- bt1.addListener("execute",function() { var self = this; this.__field.focus(); qx.event.Timer.once(function() { var focusedWidget = qx.ui.core.FocusHandler.getInstance().getFocusedWidget(); this.__field.setValue(focusedWidget + ""); }, self, 0); },this); --snip-- it should work. cheers, Alex ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel