You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/05/08 18:59:25 UTC

[13/21] git commit: [flex-asjs] [refs/heads/tlf] - don't let the child text widgets steal focus

don't let the child text widgets steal focus


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/65482623
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/65482623
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/65482623

Branch: refs/heads/tlf
Commit: 6548262307aab79b673b5d5eee3ac10184574e78
Parents: 6853279
Author: Alex Harui <ah...@apache.org>
Authored: Sat May 6 23:22:35 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:02 2017 -0700

----------------------------------------------------------------------
 .../beads/DispatchTLFKeyboardEventBead.as       | 23 +++++++++++++++++++-
 .../flex/org/apache/flex/text/html/TextLine.as  |  1 +
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65482623/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
index 286698d..7abd04f 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
@@ -26,6 +26,7 @@ package org.apache.flex.textLayout.beads
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.events.KeyboardEvent;
 	import org.apache.flex.events.utils.KeyboardEventConverter;
+	import org.apache.flex.text.events.TextEvent;
 	import org.apache.flex.textLayout.events.FocusEvent;
 
 	COMPILE::JS
@@ -109,6 +110,7 @@ package org.apache.flex.textLayout.beads
 		{
 			var host:UIBase = _strand as UIBase;
 			host.$displayObject.addEventListener(flash.events.KeyboardEvent.KEY_DOWN, keyEventHandler);
+			host.$displayObject.addEventListener(flash.events.TextEvent.TEXT_INPUT, textEventHandler);
 			host.$displayObject.addEventListener(flash.events.KeyboardEvent.KEY_UP, keyEventHandler);
 			host.$displayObject.addEventListener(flash.events.Event.ACTIVATE, eventHandler);
 			host.$displayObject.addEventListener(flash.events.Event.DEACTIVATE, eventHandler);
@@ -117,7 +119,25 @@ package org.apache.flex.textLayout.beads
 			return true;
 		}
 		
-		
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		protected function textEventHandler(event:flash.events.TextEvent):void
+		{
+			// this will otherwise bubble an event of flash.events.Event
+			event.stopImmediatePropagation();
+			var newEvent:org.apache.flex.text.events.TextEvent = new org.apache.flex.text.events.TextEvent(event.type);
+			newEvent.text = event.text;
+			(_strand as IEventDispatcher).dispatchEvent(newEvent);
+			if(newEvent.defaultPrevented)
+			{
+				event.preventDefault();
+			}
+			
+			
+		}
+				
 		/**
 		 * @private
 		 */
@@ -162,6 +182,7 @@ package org.apache.flex.textLayout.beads
 		{
 			if (event is org.apache.flex.events.Event) return;
 			
+			trace(event.type, event.target, event.relatedObject);
 			// this will otherwise dispatch an event of flash.events.FocusEvent
 			event.stopImmediatePropagation();
 			var newEvent:org.apache.flex.textLayout.events.FocusEvent = new org.apache.flex.textLayout.events.FocusEvent(event.type);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65482623/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
index 3087cd7..fbb17a3 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
@@ -44,6 +44,7 @@ package org.apache.flex.text.html
 			COMPILE::SWF
 			{
 				textField = new TextField();
+				textField.mouseEnabled = false;
 				$displayObjectContainer.addChild(textField);
 				textField.autoSize = TextFieldAutoSize.LEFT;