You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by al...@apache.org on 2018/10/26 07:06:49 UTC
[royale-asjs] branch develop updated: Spark TextInput Working
This is an automated email from the ASF dual-hosted git repository.
alinakazi pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new af1401c Spark TextInput Working
af1401c is described below
commit af1401c0c3432154e8ff8b0c3fe6605e3c036899
Author: alinakazi <AL...@GMAIL.COM>
AuthorDate: Fri Oct 26 12:06:45 2018 +0500
Spark TextInput Working
---
.../src/main/royale/spark/components/TextInput.as | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as
index a541818..142a479 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as
@@ -24,6 +24,13 @@ package spark.components
import flash.events.FocusEvent;
import flashx.textLayout.formats.LineBreak; */
+COMPILE::JS
+{
+ import goog.events;
+ import org.apache.royale.core.WrappedHTMLElement;
+ import org.apache.royale.html.util.addElementToWrapper;
+}
+
import org.apache.royale.events.Event;
import mx.core.mx_internal;
import mx.events.FlexEvent;
@@ -290,6 +297,33 @@ public class TextInput extends SkinnableTextBase
// Trigger bindings to textChanged.
dispatchEvent(new Event("textChanged"));
}
+
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ addElementToWrapper(this,'input');
+ element.setAttribute('type', 'text');
+
+ //attach input handler to dispatch royale change event when user write in textinput
+ //goog.events.listen(element, 'change', killChangeHandler);
+ goog.events.listen(element, 'input', textChangeHandler);
+ return element;
+ }
+ private var inSetter:Boolean;
+
+ /**
+ * dispatch change event in response to a textChange event
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function textChangeHandler(event:Event):void
+ {
+ if (!inSetter)
+ dispatchEvent(new Event(Event.CHANGE));
+ }
//--------------------------------------------------------------------------
//