Hi Skar,

which qooxdoo version do you use? I couldn't reproduce the issue with 
getting "null".

The reason, why "getFocusedWidget()" returns the button as focused 
widget and not the TextField is, that all actions are queued. When you 
call "field.focus()" and after this "getFocusedWidget()" the focus on 
the TextField is queued and set asynchron and "getFocusedWidget()" 
returns the current focused widget.

To solve your issue, witch you are asked on the other thread [1], you 
should add the "focusin" and "focusout" on each TextField and set the 
current focused TextField on a member variable.

Cheers,
Chris

[1] 
http://n2.nabble.com/how-to-find-out-which-widget-is-focused-inside-a-window-td3848242ef678.html

skar schrieb:
> Hi,
>
> I've got the following code in my Application.js and the problem is, on 
> app load, pressing "focus" returns me "null" with the window being 
> modal. When I switch the window to non-modal, I always get the textfield 
> as the focused widget. Now, after first time with the window still a 
> modal, I get the button as the focused widget. Note that I've set a 
> 1000ms delay and visually the text field has the focus, still the button 
> is said to have the focus. Any ideas on why?
>
>   
>> main  : function() {
>>         // Call super class
>>         this.base(arguments);
>>
>>         // Enable logging in debug variant
>>         if (qx.core.Variant.isSet("qx.debug", "on")) {
>>             // support native logging capabilities, e.g. Firebug for 
>> Firefox
>>             qx.log.appender.Native;
>>             // support additional cross-browser console. Press F7 to 
>> toggle visibility
>>             qx.log.appender.Console;
>>         }
>>
>>         var layout = new qx.ui.layout.VBox;
>>         layout.setSpacing(10);
>>         var child_container = new qx.ui.window.Window();
>>         child_container.setHeight(300);
>>         child_container.setWidth(300);
>>         child_container.setModal(true);
>>         //var child_container = new testproject.OPWindow();
>>         child_container.setLayout(layout);
>>
>>         //this.getRoot().add(child_container);
>>         child_container.open();
>>         var bt1 = new qx.ui.form.Button("Focus");
>>         var modality = "Toggle modality";
>>         var bt2 = new qx.ui.form.Button(modality + 
>> (child_container.isModal()? "(Modal)": "(Not Modal)"));
>>         var field = new qx.ui.form.TextField();
>>         child_container.add(bt1);
>>         child_container.add(bt2);
>>         child_container.add(field);
>>         bt1.addListener("execute",function(){
>>           field.focus();setTimeout(function(){
>>             var fw = 
>> qx.ui.core.FocusHandler.getInstance().getFocusedWidget();
>>             alert("Focused widget is:" + fw);
>>             field.setValue(fw);
>>           },1000);
>>         },this);
>>         bt2.addListener("execute",function(){
>>           child_container.setModal((child_container.isModal()? false: 
>> true));
>>           bt2.setLabel(modality + (child_container.isModal()? 
>> "(Modal)": "(Not Modal)"));
>>         },this);
>>
>>
>>       },
>>     
> cheers,
> skar.
>
>   


-- 
Christian Schmidt
Software Entwickler

1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
schmidt.christ...@1und1.de

Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas 
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver 
Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren


------------------------------------------------------------------------------
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

Reply via email to