flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Harui (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33570) when I press a key to pop up a new window, how to forbid inputting into the edit control in the new window?
Date Wed, 29 May 2013 18:48:22 GMT

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

Alex Harui commented on FLEX-33570:
-----------------------------------

In the following version, I am removing focus right away and restoring it on a keyUp off the
stage (which is where the event goes if nothing has focus).  Hopefully this will be sufficient
for your needs.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="setup()">
	
	<mx:Script>

		import flash.events.Event;
		import flash.events.KeyboardEvent;
		import flash.ui.Keyboard;
		
		import mx.collections.ArrayCollection;
		import mx.core.UIComponent;
		import mx.events.CloseEvent;
		import mx.managers.FocusManager;
		import mx.managers.PopUpManager;
		import mx.resources.ResourceManager;
		import mx.controls.Alert;
		
		private var dialog:Dialog=new Dialog();
		
		private	function OnKeyDown(event:KeyboardEvent):void
		{
			if (event.ctrlKey)
			{ 
				if(event.keyCode == 70) 
				{
					Show();
				}
			}
		}
		
		private function setup():void
		{
			systemManager.stage.addEventListener(KeyboardEvent.KEY_UP, OnKeyUp);
		}
		
		private	function OnKeyUp(event:KeyboardEvent):void
		{
			if (event.ctrlKey)
			{ 
				if(event.keyCode == 70) 
				{
					dialog.FindText.setFocus();
				}
			}
		}
		
		private function Show():void
		{
			PopUpManager.addPopUp(dialog, this, false);
			systemManager.stage.focus = null;
		}
		
	</mx:Script>
	
	
	<mx:Form x="57" y="43" width="616" height="363" backgroundColor="#52EE9F">
		<mx:TextArea id="textArea" keyDown="OnKeyDown(event);" width="584" height="327"/>
	</mx:Form>
	
</mx:Application>

                
> when I press a key to pop up a new window, how to forbid inputting into the edit control
in the new window?
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: FLEX-33570
>                 URL: https://issues.apache.org/jira/browse/FLEX-33570
>             Project: Apache Flex
>          Issue Type: Question
>          Components: mx: TitleWindow
>    Affects Versions: Adobe Flex SDK 3.2 (Release)
>         Environment: IE
>            Reporter: Aaron
>         Attachments: focus ont on the new window.jpg, Hello4.rar, HelloFlex.rar
>
>
> Hello,
> I press a key like "A" as shortcut to pop up a new window with an input control and meantime
set focus to the input control.  After the new window pop up, the input control would show
a "A" on it. 
> The code is as below:
> 	private var dialog:Dialog=new Dialog();
> 	private	function OnKeyDown(event:KeyboardEvent):void
> 	{
> 		if (event.ctrlKey)
> 		{ 
> 			if(event.keyCode == 70) Show();
> 		}
> 	}
> 	
> 	private function Show():void
> 	{
> 		PopUpManager.addPopUp(dialog, this, false);
> 		dialog.FindText.setFocus();
> 	}
> </mx:Script>
> 	<mx:Form x="57" y="43" width="616" height="363" backgroundColor="#52EE9F">
> 		<mx:TextArea id="textArea" keyDown="OnKeyDown(event);" width="584" height="327"/>
> 	</mx:Form>
> I am looking forward to your reply. Thank you.

--
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

Mime
View raw message