[
https://issues.apache.org/jira/browse/FLEX-28045?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Mclean updated FLEX-28045:
---------------------------------
Labels: easyfix easytest (was: )
> 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