You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Dave Glasser <dg...@pobox.com> on 2015/08/21 23:10:07 UTC

Odd tab/focus behavior

I'm using Flex 4.13.0, on the AIR 14.something platform. I have a login dialog, that has username/password fields (both mx.controls.TextInput) that are in a VBox in a Panel that was popped up by the PopUpManager.
Inside a handler for its creationComplete event, I am focusing the username field like this:
usernameField.setFocus();
and I've also tried 

focusManager.setFocus(usernameField);
When the dialog first appears, the cursor is blinking inside the username field and it has the focus rectangle, as you'd expect. When I type in a username, the letters appear in the field as expected.
The problem is that the first time I hit the tab key, nothing happens. Maybe the cursor inside the field flickers but that's it. And if I hit the tab key a second time, it behaves as expected, with the focus moving to the password field.

If, before I hit the tab key the first time, I click inside the text field with the mouse, then the first tab keystroke shifts the focus as expected.
Has anyone encountered this before?


Re: Odd tab/focus behavior

Posted by Dave Glasser <dg...@pobox.com>.
My bad. I had in fact been compiling a modified version of FocusManager into my code, and what I did below overwrote my mods with the original source. Apparently  my mods were causing the problem. So now that I know roughly where the problem is, I should be able to pinpoint it.

Long ago I changed this in FocusManager:

    form.addEventListener(KeyboardEvent.KEY_DOWN, defaultButtonKeyHandler);
    form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);


to this:

      form.addEventListener(KeyboardEvent.KEY_UP, defaultButtonKeyHandler); 
      form.addEventListener(KeyboardEvent.KEY_UP, keyDownHandler, true);    


I wanted to change the behavior of the ENTER key, not the tab key. I was having problems that when dialogs were dismissed with the enter key, the KEY_UP event would get dispatched in the dialog's parent, and that was causing me grief in a few places. I should be able to fix it so I keep my desired behavior for the ENTER key, and the correct behavior for the tab KEY_DOWN as well.

Thanks Alex, as always, for sharing your insights.
      From: Alex Harui <ah...@adobe.com>
 To: "users@flex.apache.org" <us...@flex.apache.org>; Dave Glasser <dg...@pobox.com> 
 Sent: Friday, August 21, 2015 7:11 PM
 Subject: Re: Odd tab/focus behavior
   


On 8/21/15, 4:03 PM, "Dave Glasser" <dg...@pobox.com> wrote:

>
>Clicking the titlebar of the main window, then back to the spawned window
>before typing (which should generate Event.ACTIVATE) does not help.
>But here's something else that makes no sense. I compiled FocusManager.as
>from the Flex 4.13.0 SDK into my app so I could put some trace statements
>in it. And without changing anything, that fixed the problem. So I'm not
>going to argue with success. I'll just add it to my build, and keep an
>eye out for other problems that might arise because of it.
>
>But is it possible that the FocusManager class that's compiled into the
>4.13.0 library SWC was not compiled from that source file? I'm quite sure
>I'm compiling with the 4.13.0 SDK's mxmlc.bat.

That’s weird.  You can swfdump the FocusManager and compare it to the
source if you really want to know.
Are you using any third-party SWCs?  If they have a FocusManager depending
on how it was built there is a slim chance it would get linked in instead
of the one in the framework.swc.  Or if you happen to have another
monkey-patched FocusManager on the source-path, that one could be getting


in.

-Alex
  



  

Re: Odd tab/focus behavior

Posted by Alex Harui <ah...@adobe.com>.

On 8/21/15, 4:03 PM, "Dave Glasser" <dg...@pobox.com> wrote:

>
>Clicking the titlebar of the main window, then back to the spawned window
>before typing (which should generate Event.ACTIVATE) does not help.
>But here's something else that makes no sense. I compiled FocusManager.as
>from the Flex 4.13.0 SDK into my app so I could put some trace statements
>in it. And without changing anything, that fixed the problem. So I'm not
>going to argue with success. I'll just add it to my build, and keep an
>eye out for other problems that might arise because of it.
>
>But is it possible that the FocusManager class that's compiled into the
>4.13.0 library SWC was not compiled from that source file? I'm quite sure
>I'm compiling with the 4.13.0 SDK's mxmlc.bat.

That’s weird.  You can swfdump the FocusManager and compare it to the
source if you really want to know.
Are you using any third-party SWCs?  If they have a FocusManager depending
on how it was built there is a slim chance it would get linked in instead
of the one in the framework.swc.  Or if you happen to have another
monkey-patched FocusManager on the source-path, that one could be getting
in.

-Alex
  


Re: Odd tab/focus behavior

Posted by Dave Glasser <dg...@pobox.com>.
Clicking the titlebar of the main window, then back to the spawned window before typing (which should generate Event.ACTIVATE) does not help.
But here's something else that makes no sense. I compiled FocusManager.as from the Flex 4.13.0 SDK into my app so I could put some trace statements in it. And without changing anything, that fixed the problem. So I'm not going to argue with success. I'll just add it to my build, and keep an eye out for other problems that might arise because of it.

But is it possible that the FocusManager class that's compiled into the 4.13.0 library SWC was not compiled from that source file? I'm quite sure I'm compiling with the 4.13.0 SDK's mxmlc.bat.
      From: Alex Harui <ah...@adobe.com>
 To: "users@flex.apache.org" <us...@flex.apache.org>; Dave Glasser <dg...@pobox.com> 
 Sent: Friday, August 21, 2015 6:40 PM
 Subject: [BASE64] Re: [BASE64] Re: Odd tab/focus behavior
   
It could be that that particular AIR window isn’t activated or the
FocusManager doesn’t think it is activated.  There are Event.ACTIVATE and
Event.DEACTIVATE that go to each window and FocusManager is listening to
those events.

-Alex



On 8/21/15, 3:12 PM, "Dave Glasser" <dg...@pobox.com> wrote:

>It's a desktop AIR app, Alex. It's in a spark.components.Window spawned
>off the main application window, opened with  .open(true). And if I click
>the native window's titlebar before I type, it's no help either.
>
>      From: Alex Harui <ah...@adobe.com>
> To: "users@flex.apache.org" <us...@flex.apache.org>; Dave Glasser
><dg...@pobox.com>
> Sent: Friday, August 21, 2015 5:23 PM
> Subject: [BASE64] Re: Odd tab/focus behavior
>  
>Sounds like the browser hasn’t activated the SWF?  Maybe SWFObject no
>longer works properly on certain browsers?
>
>-Alex
>
>
>
>On 8/21/15, 2:10 PM, "Dave Glasser" <dg...@pobox.com> wrote:
>
>>I'm using Flex 4.13.0, on the AIR 14.something platform. I have a login
>>dialog, that has username/password fields (both mx.controls.TextInput)
>>that are in a VBox in a Panel that was popped up by the PopUpManager.
>>Inside a handler for its creationComplete event, I am focusing the
>>username field like this:
>>usernameField.setFocus();
>>and I've also tried
>>
>>focusManager.setFocus(usernameField);
>>When the dialog first appears, the cursor is blinking inside the username
>>field and it has the focus rectangle, as you'd expect. When I type in a
>>username, the letters appear in the field as expected.
>>The problem is that the first time I hit the tab key, nothing happens.
>>Maybe the cursor inside the field flickers but that's it. And if I hit
>>the tab key a second time, it behaves as expected, with the focus moving
>>to the password field.
>>
>>If, before I hit the tab key the first time, I click inside the text
>>field with the mouse, then the first tab keystroke shifts the focus as
>>expected.
>>Has anyone encountered this before?
>>
>
>
>
>  



  

Re: [BASE64] Re: Odd tab/focus behavior

Posted by Alex Harui <ah...@adobe.com>.
It could be that that particular AIR window isn’t activated or the
FocusManager doesn’t think it is activated.  There are Event.ACTIVATE and
Event.DEACTIVATE that go to each window and FocusManager is listening to
those events.

-Alex

On 8/21/15, 3:12 PM, "Dave Glasser" <dg...@pobox.com> wrote:

>It's a desktop AIR app, Alex. It's in a spark.components.Window spawned
>off the main application window, opened with  .open(true). And if I click
>the native window's titlebar before I type, it's no help either.
>
>      From: Alex Harui <ah...@adobe.com>
> To: "users@flex.apache.org" <us...@flex.apache.org>; Dave Glasser
><dg...@pobox.com>
> Sent: Friday, August 21, 2015 5:23 PM
> Subject: [BASE64] Re: Odd tab/focus behavior
>   
>Sounds like the browser hasn’t activated the SWF?  Maybe SWFObject no
>longer works properly on certain browsers?
>
>-Alex
>
>
>
>On 8/21/15, 2:10 PM, "Dave Glasser" <dg...@pobox.com> wrote:
>
>>I'm using Flex 4.13.0, on the AIR 14.something platform. I have a login
>>dialog, that has username/password fields (both mx.controls.TextInput)
>>that are in a VBox in a Panel that was popped up by the PopUpManager.
>>Inside a handler for its creationComplete event, I am focusing the
>>username field like this:
>>usernameField.setFocus();
>>and I've also tried
>>
>>focusManager.setFocus(usernameField);
>>When the dialog first appears, the cursor is blinking inside the username
>>field and it has the focus rectangle, as you'd expect. When I type in a
>>username, the letters appear in the field as expected.
>>The problem is that the first time I hit the tab key, nothing happens.
>>Maybe the cursor inside the field flickers but that's it. And if I hit
>>the tab key a second time, it behaves as expected, with the focus moving
>>to the password field.
>>
>>If, before I hit the tab key the first time, I click inside the text
>>field with the mouse, then the first tab keystroke shifts the focus as
>>expected.
>>Has anyone encountered this before?
>>
>
>
>
>  


Re: [BASE64] Re: Odd tab/focus behavior

Posted by Dave Glasser <dg...@pobox.com>.
It's a desktop AIR app, Alex. It's in a spark.components.Window spawned off the main application window, opened with  .open(true). And if I click the native window's titlebar before I type, it's no help either.

      From: Alex Harui <ah...@adobe.com>
 To: "users@flex.apache.org" <us...@flex.apache.org>; Dave Glasser <dg...@pobox.com> 
 Sent: Friday, August 21, 2015 5:23 PM
 Subject: [BASE64] Re: Odd tab/focus behavior
   
Sounds like the browser hasn’t activated the SWF?  Maybe SWFObject no
longer works properly on certain browsers?

-Alex



On 8/21/15, 2:10 PM, "Dave Glasser" <dg...@pobox.com> wrote:

>I'm using Flex 4.13.0, on the AIR 14.something platform. I have a login
>dialog, that has username/password fields (both mx.controls.TextInput)
>that are in a VBox in a Panel that was popped up by the PopUpManager.
>Inside a handler for its creationComplete event, I am focusing the
>username field like this:
>usernameField.setFocus();
>and I've also tried
>
>focusManager.setFocus(usernameField);
>When the dialog first appears, the cursor is blinking inside the username
>field and it has the focus rectangle, as you'd expect. When I type in a
>username, the letters appear in the field as expected.
>The problem is that the first time I hit the tab key, nothing happens.
>Maybe the cursor inside the field flickers but that's it. And if I hit
>the tab key a second time, it behaves as expected, with the focus moving
>to the password field.
>
>If, before I hit the tab key the first time, I click inside the text
>field with the mouse, then the first tab keystroke shifts the focus as
>expected.
>Has anyone encountered this before?
>



  

Re: Odd tab/focus behavior

Posted by Alex Harui <ah...@adobe.com>.
Sounds like the browser hasn’t activated the SWF?  Maybe SWFObject no
longer works properly on certain browsers?

-Alex

On 8/21/15, 2:10 PM, "Dave Glasser" <dg...@pobox.com> wrote:

>I'm using Flex 4.13.0, on the AIR 14.something platform. I have a login
>dialog, that has username/password fields (both mx.controls.TextInput)
>that are in a VBox in a Panel that was popped up by the PopUpManager.
>Inside a handler for its creationComplete event, I am focusing the
>username field like this:
>usernameField.setFocus();
>and I've also tried
>
>focusManager.setFocus(usernameField);
>When the dialog first appears, the cursor is blinking inside the username
>field and it has the focus rectangle, as you'd expect. When I type in a
>username, the letters appear in the field as expected.
>The problem is that the first time I hit the tab key, nothing happens.
>Maybe the cursor inside the field flickers but that's it. And if I hit
>the tab key a second time, it behaves as expected, with the focus moving
>to the password field.
>
>If, before I hit the tab key the first time, I click inside the text
>field with the mouse, then the first tab keystroke shifts the focus as
>expected.
>Has anyone encountered this before?
>