This is an automated email from the ASF dual-hosted git repository.
hugoferreira 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 6529985a4f New bead to auto scroll a Jewel Text Input when the text
change
6529985a4f is described below
commit 6529985a4f64718d52ec28a2c82eaebdc864280d
Author: Hugo Ferreira <[email protected]>
AuthorDate: Tue Apr 11 00:50:54 2023 +0100
New bead to auto scroll a Jewel Text Input when the text change
---
.../Jewel/src/main/resources/jewel-manifest.xml | 1 +
.../jewel/beads/controls/textinput/AutoScroll.as | 75 ++++++++++++++++++++++
2 files changed, 76 insertions(+)
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 157c54653a..b354473aa8 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -222,6 +222,7 @@
<component id="MaxNumberCharacters"
class="org.apache.royale.jewel.beads.controls.textinput.MaxNumberCharacters"/>
<component id="Restrict"
class="org.apache.royale.jewel.beads.controls.textinput.Restrict"/>
<component id="UpperCase"
class="org.apache.royale.jewel.beads.controls.textinput.UpperCase"/>
+ <component id="AutoScroll"
class="org.apache.royale.jewel.beads.controls.textinput.AutoScroll"/>
<component id="SearchFilterForList"
class="org.apache.royale.jewel.beads.controls.textinput.SearchFilterForList"/>
<component id="LowerCase"
class="org.apache.royale.jewel.beads.controls.textinput.LowerCase"/>
<component id="TruncateText"
class="org.apache.royale.jewel.beads.controls.textinput.TruncateText"/>
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/AutoScroll.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/AutoScroll.as
new file mode 100644
index 0000000000..e645a46508
--- /dev/null
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/AutoScroll.as
@@ -0,0 +1,75 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.jewel.beads.controls.textinput
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.jewel.supportClasses.textinput.TextInputBase;
+
+ /**
+ * The AutoScroll class is a specialty bead that can be used with
+ * any Jewel TextInputBase control. The bead makes the scroll at the
bottom every time the text change
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class AutoScroll implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.10
+ */
+ public function AutoScroll()
+ {
+ }
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.10
+ */
+ public function set strand(value:IStrand):void
+ {
+ (value as TextInputBase).addEventListener("textChange",
textChangeHandler);
+ }
+
+ /**
+ * Scroll to bottom
+ *
+ * @private
+ */
+ protected function textChangeHandler(event:Event):void
+ {
+ COMPILE::JS
+ {
+ event.target.element.scrollTop =
event.target.element.scrollHeight;
+ }
+ }
+ }
+}
\ No newline at end of file