Gaetan de Menten | 7 Oct 17:02

How to get the currently focused widget?

When saving a form, I need to make sure my local datastore is updated
with the on-screen value of the fields of the form. This happens
automatically when the user saves the form through the "save" button
on the toolbar, since the current field loose focus. But if the
current fields doesn't loose focus (if the user saves through the
Ctrl-S keyboard shortcut), I have to do it manually.

In 0.7, I used to do:
    var focusRoot = containerWidget.getFocusRoot();
    if (focusRoot) {
        var child = focusRoot.getFocusedChild();
        if (child) {
            child.blur();
            child.focus();
        }
    }

I couldn't find a way to get to the currently focused widget in 0.8.
Anyone knows the way to do it?

PS: I know I could just force an update of *all* widgets value, but
I'd rather avoid it since it's totally unnecessary.

--

-- 
Gaëtan de Menten
http://openhex.org

-------------------------------------------------------------------------
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
(Continue reading)

Fabian Jakobs | 8 Oct 09:57
Favicon

Re: How to get the currently focused widget?

Gaetan de Menten schrieb:
> When saving a form, I need to make sure my local datastore is updated
> with the on-screen value of the fields of the form. This happens
> automatically when the user saves the form through the "save" button
> on the toolbar, since the current field loose focus. But if the
> current fields doesn't loose focus (if the user saves through the
> Ctrl-S keyboard shortcut), I have to do it manually.
>
> In 0.7, I used to do:
>     var focusRoot = containerWidget.getFocusRoot();
>     if (focusRoot) {
>         var child = focusRoot.getFocusedChild();
>         if (child) {
>             child.blur();
>             child.focus();
>         }
>     }
>
> I couldn't find a way to get to the currently focused widget in 0.8.
> Anyone knows the way to do it?
>
>   
These method is missing in 0.8. I just added them to trunk. If you have 
trunk you can use

qx.ui.core.FocusHandler.getInstance().getFocusedWidget();

Best Fabian

--

-- 
(Continue reading)

Gaetan de Menten | 8 Oct 10:51

Re: How to get the currently focused widget?

On Wed, Oct 8, 2008 at 9:57 AM, Fabian Jakobs <fabian.jakobs <at> 1und1.de> wrote:
> Gaetan de Menten schrieb:

>> I couldn't find a way to get to the currently focused widget in 0.8.
>> Anyone knows the way to do it?

> These method is missing in 0.8. I just added them to trunk. If you have
> trunk you can use
>
> qx.ui.core.FocusHandler.getInstance().getFocusedWidget();

Thanks for the quick reaction. It seems to work fine.

--

-- 
Gaëtan de Menten
http://openhex.org

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

Gmane