You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2022/07/13 15:20:58 UTC
[royale-asjs] branch develop updated: Emulation - allow numeric stepper to accept empty string as beginning of new value input
This is an automated email from the ASF dual-hosted git repository.
yishayw 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 4f9b72cfd0 Emulation - allow numeric stepper to accept empty string as beginning of new value input
4f9b72cfd0 is described below
commit 4f9b72cfd0b4a68a47dc192c9f59866520a43ad1
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Wed Jul 13 18:20:49 2022 +0300
Emulation - allow numeric stepper to accept empty string as beginning of new value input
---
.../main/royale/mx/controls/beads/NumericStepperView.as | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/NumericStepperView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/NumericStepperView.as
index 91b3fc2bd8..179c17f951 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/NumericStepperView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/NumericStepperView.as
@@ -24,6 +24,8 @@ package mx.controls.beads
import org.apache.royale.core.IUIBase;
import org.apache.royale.html.beads.NumericStepperView;
import org.apache.royale.events.Event;
+ import mx.events.FocusEvent;
+ import org.apache.royale.events.IEventDispatcher;
/**
* The NumericStepperView class overrides the Basic
@@ -64,6 +66,7 @@ package mx.controls.beads
*/
override protected function inputChangeHandler(event:Event) : void
{
+ var isTextInputEmpty:Boolean = input.text == "";
var signAndNumber:Array = input.text.split("-");
var newValue:Number = Number(signAndNumber.length == 2 ? signAndNumber[1] : signAndNumber[0]);
var sign:int = signAndNumber.length == 2 ? -1 : 1;
@@ -74,8 +77,19 @@ package mx.controls.beads
else {
input.text = String(spinner.value);
}
+ if (isTextInputEmpty)
+ {
+ input.text = ""; // We want to allow user to type a new value regardless of above constraints
+ (_strand as IEventDispatcher).addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
+ }
}
+ private function focusOutHandler(event:FocusEvent):void
+ {
+ input.text = "" + spinner.value;
+ (_strand as IEventDispatcher).removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
+ }
+
}