PopupManager: Tab Order not working in Modal Popup
Posted by ryangJan 28
I was working with a PopUp window today in Flex 4.1 and was experiencing some wonkiness when I pressed the ‘tab’ key. Expecting the focus to move from one textinput field to the next, instead, the focus went back to the containing window. My pop-up window was modal, so this is not what I expected.
My ninja google skillz returned the following fix I thought I’d share with you. You can find the fix here at DoubletMedia.
I attempted his fix var fm:FocusManager = new FocusManager(this); fm.activate();
in my popup using Flex 4.1 and got the following compiler error:
Description Resource Path Location Type
1067: Implicit coercion of a value of type com.mgh.app.Prompt to an unrelated type mx.managers:IFocusManagerContainer. Prompt.mxml /app/src/com/mgh/app/view line 43 Flex Problem
The documentation for IFocusManagerContainer states:
“The PopUpManager automatically installs a FocusManager in any IFocusManagerContainer it pops up.”
So rather than manually instantiating a FocusManager, I implemented the IFocusManagerContainer in my popup:
<s:Group ... implements="mx.managers.IFocusManagerContainer" ... >
<fx:Script><![CDATA[
import mx.core.IFlexDisplayObject;
protected var _defaultButton:IFlexDisplayObject;
public function get defaultButton():IFlexDisplayObject {
return _defaultButton;
}
public function set defaultButton(value:IFlexDisplayObject):void {
_defaultButton = value;
}
]]></fx:Script>
No comments