You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/11/24 07:10:33 UTC
[royale-asjs] branch develop updated: implement Enter event. Should
fix #574
This is an automated email from the ASF dual-hosted git repository.
aharui 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 38efdf9 implement Enter event. Should fix #574
38efdf9 is described below
commit 38efdf927dfd37454a0015ca5464e8d711e7dbb7
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Nov 23 23:09:33 2019 -0800
implement Enter event. Should fix #574
---
.../MXRoyale/src/main/royale/mx/controls/TextInput.as | 19 +++++++++++++++++++
.../MXRoyale/src/main/royale/mx/events/FlexEvent.as | 2 +-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
index 52e71cf..dc5a75c 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
@@ -1624,6 +1624,7 @@ public class TextInput extends UIComponent implements ITextInput
//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);
+ goog.events.listen(element, 'keypress', enterEventHandler);
return element;
}
@@ -1646,6 +1647,24 @@ public class TextInput extends UIComponent implements ITextInput
}
}
+ /**
+ * dispatch change event in response to a textChange event
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ COMPILE::JS
+ public function enterEventHandler(event:Event):void
+ {
+ if (event['key'] === 'Enter') {
+ // Cancel the default action, if needed
+ event.preventDefault();
+ dispatchEvent(new Event(FlexEvent.ENTER));
+ }
+ }
+
//--------------------------------------------------------------------------
//
// Methods
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as
index a657d27..83aaa58 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as
@@ -409,7 +409,7 @@ public class FlexEvent extends Event
* @playerversion AIR 1.1
* @productversion Royale 0.9.3
*/
- //public static const ENTER:String = "enter";
+ public static const ENTER:String = "enter";
/**
* The <code>FlexEvent.ENTER_FRAME</code> constant defines the value of the