Nick Middleweek wrote:
>
> Hi,
>
> Check out the example on the Alert language reference...
> http://livedocs.adobe.com/flex/3/langref/mx/controls/Alert.html#includeExamplesSummary
>
> You can assign a callback Handler like in the example:
>
> alertClickHandler()
>
> ... where you can check the button clicked and in that function you can
> restore focus to the object you previously set focus to.
Hi,
Thanks for the response. I'm very well aware of the close handler but
AFAICT, the close handler is given a CloseEvent object. If I want to set
focus to my rogue element, I'd have to save the reference to my element in
some global variable, which would then be used by my close handler to again
set the focus. Isn't there is way in which I can make the close event set
the focus or move the focus to the element which had the focus before the OK
button was clicked? For e.g. I've something like:
private function validate():Boolean
{
if(txtName.text == null || txtName.text == "")
{
controlToFocus = txtName;
Alert.show("Please enter name", "", 0x4, this, alertClickHandler);
return false;
}
return true;
}
private function alertClickHandler(event:Event=null):void
{
// Can this be replaced to *not* use a global state
controlToFocus.setFocus();
}
I hope I've managed to express my concern here, suggestions appreciated.
TIA.
--
View this message in context:
http://old.nabble.com/Setting-focus-after-confirming-Alert-tp26885230p26887130.html
Sent from the FlexCoders mailing list archive at Nabble.com.