flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shigeru Nakagaki (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-28045) FocusManager throws TypeError
Date Thu, 20 Jun 2013 07:02:21 GMT

    [ https://issues.apache.org/jira/browse/FLEX-28045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13688951#comment-13688951

Shigeru Nakagaki commented on FLEX-28045:

I can not reproduce surely this RTE.
But this RTE still happens sometimes on changing from PopUp to other view.
And definitely the code should check defButton is not null because defButton can be null sometimes.
> FocusManager throws TypeError
> -----------------------------
>                 Key: FLEX-28045
>                 URL: https://issues.apache.org/jira/browse/FLEX-28045
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: .Unspecified - Framework
>    Affects Versions: Adobe Flex SDK 4.5.1 (Release)
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Browser: Other (specify version)
> Language Found: English
>            Reporter: Adobe JIRA
>              Labels: easyfix, easytest
> Steps to reproduce:
> 1. In some MXML component (a dialog or application), create a Grid with a mx:TextInput
and a mx:Button. The grid is called "myGrid" and the button is called "myButton"
> 2. Overload createChildren of the enclosing component. Inside createChildren (after calling
super.createChildren), set the focusmanager:
> 	myFocus = new FocusManager( myGrid );
> 	myFocus.defaultButton = myButton;
> 3. Run the app. Click in the textinput, enter some text and hit 'Enter'.
>  Actual Results:
>  The app throws an error:
> TypeError: Error #1009: Cannot access a property or method of a null object reference.
> 	at mx.managers::FocusManager/defaultButtonKeyHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\FocusManager.as:2082]
>  Expected Results:
> No error...
>  Workaround (if any):
> Unknown 
>  Comments:
> I have not made the effort of understanding the complete code of the FocusManager, but
I understand the following: FocusManager has 2 vars to keep track of the default button: defaultButton
and defButton. It seems that defaultButton is the 'designated' defaultbutton and defButton
the current default button, being null if there can not be any focus. In the key handler,
the following code causes the error:
>     private function defaultButtonKeyHandler(event:KeyboardEvent):void
>     {        
>         var sm:ISystemManager = form.systemManager;
>         if (hasEventListener("defaultButtonKeyHandler"))
>     		if (!dispatchEvent(new FocusEvent("defaultButtonKeyHandler", false, true)))
> 	    		return;
>         if (defaultButtonEnabled && event.keyCode == Keyboard.ENTER &&
>             defaultButton && defButton.enabled)
>         {
>             sendDefaultButtonEvent();
>     }
>     }
> In the second if-clause, the code doesn't check whether defButton is null. It seems odd
that the code checks defaultButton for null and then accesses defButton, not defaultButton.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message