This is a known focus issue, I think there’s
a knowledge base article somewhere but I can’t seem to locate it right
now.
Basically the alert popup doesn’t
get activated with the System Manager and can’t receive tab focus.
The workaround is to launch the alert in a
function, use a doLater() and then active the popup.
Here’s an example:
<?xml version="1.0"
encoding="utf-8"?>
<mx:TitleWindow
xmlns:mx="http://www.macromedia.com/2003/mxml" title="Pop"
closeButton="true" click="this.deletePopUp();">
<mx:Script>
<![CDATA[
import
mx.managers.SystemManager;
var
myAlert;
function
showAlrt(){
myAlert
= mx.controls.Alert.show('Try hitting tab or
enter','Alert',mx.controls.Alert.YES|mx.controls.Alert.NO);
doLater(this,
"fixfocus");
}
function
fixfocus(){
SystemManager.activate(myAlert);
}
]]>
</mx:Script>
<mx:Button
label="Show Alert" click="showAlrt()"/>
</mx:TitleWindow>
- pw
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of mrmcfeely8
Sent: Friday, March 31, 2006 11:16
AM
To: [email protected]
Subject: [flexcoders] Re: Modal
popup problem - Flex 1.5
Here's some sample code that
will illustrate the problem:
/****************
testApp.mxml
****************/
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
creationComplete="beginTheChaos()"
>
<mx:Script>
<![CDATA[
function
beginTheChaos(){
mx.managers.PopUpManager.createPopUp(this,
testPopup, true,
undefined);
}
]]>
</mx:Script>
</mx:Application>
/****************
testPopup.mxml
****************/
<?xml version="1.0"
encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Form
id="testForm" defaultButton="submitButton">
<mx:FormItem width="100%"
label="Field 1">
<mx:TextInput
id="field1" tabIndex="1"
/>
</mx:FormItem>
<mx:FormItem width="100%"
label="Field 2">
<mx:TextInput
id="field2" tabIndex="2"
/>
</mx:FormItem>
<mx:FormItem width="100%"
label="Field 3">
<mx:TextInput
id="field3" tabIndex="3"
/>
</mx:FormItem>
</mx:Form>
<mx:ControlBar
width="100%" horizontalAlign="center">
<mx:Button label="Submit"
click="mx.controls.Alert.show('Try hitting
tab or enter','Screwed
up...',mx.controls.Alert.YES|mx.controls.Alert.NO,
MovieClip(_root),
undefined, undefined,
mx.controls.Alert.YES);" id="submitButton" />
</mx:ControlBar>
</mx:TitleWindow>
Anyone with any thoughts on this?
--- In [email protected],
"mrmcfeely8"
<[EMAIL PROTECTED]> wrote:
>
> I'm running into a problem that's driving me
insane:
>
> If you open a modal popup from a modal popup,
it seems like all key
> strokes are captured by the *first* popup,
not the top-most popup.
>
> For example, create a modal popup containing
a form, and open another
> modal popup with a form from the first
popup. If you were to hit TAB
> to cycle through fields on the top-most
popup, you'd find that it
> would actually cycle through the fields on
the underlying popup!
>
> The specific situation that I'm running into
is with a popup that
> contains a form, and if you try submitting
that form and there are
> validation errors, a basic Alert is shown
notifying the user that
> errors still exist. The problem occurs
when the user hits ENTER to
> try and close that Alert. Rather than
simulating a click on the
> Alert's default button, it actually simulates
a click on the
> underlying Form's default button, which in
turn opens up another
Alert!!!
>
> Any ideas? Anyone else run into this
problem?
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS