You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/11 19:01:28 UTC

[royale-asjs] branch develop updated: jewel textinput examples

This is an automated email from the ASF dual-hosted git repository.

carlosrovira 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 b47459c  jewel textinput examples
b47459c is described below

commit b47459c428c6b1334059df7b955fccc24401c666
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Tue Sep 11 21:01:23 2018 +0200

    jewel textinput examples
---
 .../src/main/royale/TextInputPlayGround.mxml       | 34 ++++++++++++++++++++--
 .../supportClasses/textinput/TextInputBase.as      |  5 ++++
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
index 53854ad..5c16b91 100644
--- a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
@@ -22,6 +22,22 @@ limitations under the License.
 		xmlns:js="library://ns.apache.org/royale/basic"
 		xmlns:html="library://ns.apache.org/royale/html">
 
+	<fx:Script>
+		<![CDATA[
+            private function onValueChange(event:Event):void
+			{
+				// trace("onValueChange"); // if target IE11 you must use this event handler
+				textinput.width = slider_w.value;
+				// button.height = slider_h.value;
+			}
+
+			private function textInputChange(event:Event):void
+			{
+				textToChange.text = event.target.text;
+			}
+		]]>
+	</fx:Script>
+
 	<j:beads>
         <js:ContainerDataBinding/>
     </j:beads>
@@ -39,14 +55,14 @@ limitations under the License.
 						<j:HorizontalLayout gap="3"/>
 					</j:beads>
 					<j:Button text="Check it!" emphasis="primary"/>
-					<j:TextInput text="A TextInput"/>
+					<j:TextInput text="A TextInput" change="textInputChange(event)"/>
 				</j:Group>
 
 				<j:Group>
 					<j:beads>
 						<j:HorizontalLayout gap="3"/>
 					</j:beads>
-					<j:TextInput>
+					<j:TextInput id="textToChange">
 						<j:beads>
 							<j:TextPrompt prompt="With prompt..."/>
 						</j:beads>
@@ -61,12 +77,24 @@ limitations under the License.
 					</j:beads>
 				</j:TextInput>
 
-				<j:TextInput>
+				<j:TextInput text="{textToChange.text}">
 					<j:beads>
 						<j:TextPrompt prompt="Disabled with prompt..."/>
 						<j:Disabled/>
 					</j:beads>
 				</j:TextInput>
+				
+				<j:HGroup gap="3" itemsVerticalAlign="itemsSameHeight">
+					<j:TextInput id="textinput">
+						<j:beads>
+							<j:TextPrompt prompt="Slider resize..."/>
+						</j:beads>
+					</j:TextInput>
+					<j:Label text="A label to check layout"/>
+				</j:HGroup>
+
+				<j:Slider id="slider_w" width="350" value="211" minimum="10" maximum="350" valueChange="onValueChange(event)"/>
+				<j:Label text="textinput.width='{textinput.width}'"/>
 			</j:Card>
 		</j:GridCell>
 		
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as
index ad41d99..f3ce7f5 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as
@@ -146,6 +146,7 @@ package org.apache.royale.jewel.supportClasses.textinput
             }
 		}
 
+        COMPILE::SWF
         private var inSetter:Boolean;
 
         /**
@@ -158,8 +159,12 @@ package org.apache.royale.jewel.supportClasses.textinput
 		 */
 		public function textChangeHandler(event:Event):void
 		{
+            COMPILE::SWF
+            {
             if (!inSetter)
                 dispatchEvent(new Event(Event.CHANGE));
+            }
+            dispatchEvent(new Event(Event.CHANGE));
 		}
 
         COMPILE::JS


Re: [royale-asjs] branch develop updated: jewel textinput examples

Posted by Carlos Rovira <ca...@apache.org>.
Hi, in this example I make a text input text binds to other, and this later
to other one. When I change the first, only the second changes, and when
change the second the third one changes.

I expect that changes in first make changes in second and third happens,
and changes in second changes third as actualy happens.

So what it makes me doubt is the changes in first one. Is this the expected?

Thanks!

Carlos



El mar., 11 sept. 2018 a las 21:01, <ca...@apache.org> escribió:

> This is an automated email from the ASF dual-hosted git repository.
>
> carlosrovira 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 b47459c  jewel textinput examples
> b47459c is described below
>
> commit b47459c428c6b1334059df7b955fccc24401c666
> Author: Carlos Rovira <ca...@apache.org>
> AuthorDate: Tue Sep 11 21:01:23 2018 +0200
>
>     jewel textinput examples
> ---
>  .../src/main/royale/TextInputPlayGround.mxml       | 34
> ++++++++++++++++++++--
>  .../supportClasses/textinput/TextInputBase.as      |  5 ++++
>  2 files changed, 36 insertions(+), 3 deletions(-)
>
> diff --git
> a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
> b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
> index 53854ad..5c16b91 100644
> --- a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
> +++ b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
> @@ -22,6 +22,22 @@ limitations under the License.
>                 xmlns:js="library://ns.apache.org/royale/basic"
>                 xmlns:html="library://ns.apache.org/royale/html">
>
> +       <fx:Script>
> +               <![CDATA[
> +            private function onValueChange(event:Event):void
> +                       {
> +                               // trace("onValueChange"); // if target
> IE11 you must use this event handler
> +                               textinput.width = slider_w.value;
> +                               // button.height = slider_h.value;
> +                       }
> +
> +                       private function textInputChange(event:Event):void
> +                       {
> +                               textToChange.text = event.target.text;
> +                       }
> +               ]]>
> +       </fx:Script>
> +
>         <j:beads>
>          <js:ContainerDataBinding/>
>      </j:beads>
> @@ -39,14 +55,14 @@ limitations under the License.
>                                                 <j:HorizontalLayout
> gap="3"/>
>                                         </j:beads>
>                                         <j:Button text="Check it!"
> emphasis="primary"/>
> -                                       <j:TextInput text="A TextInput"/>
> +                                       <j:TextInput text="A TextInput"
> change="textInputChange(event)"/>
>                                 </j:Group>
>
>                                 <j:Group>
>                                         <j:beads>
>                                                 <j:HorizontalLayout
> gap="3"/>
>                                         </j:beads>
> -                                       <j:TextInput>
> +                                       <j:TextInput id="textToChange">
>                                                 <j:beads>
>                                                         <j:TextPrompt
> prompt="With prompt..."/>
>                                                 </j:beads>
> @@ -61,12 +77,24 @@ limitations under the License.
>                                         </j:beads>
>                                 </j:TextInput>
>
> -                               <j:TextInput>
> +                               <j:TextInput text="{textToChange.text}">
>                                         <j:beads>
>                                                 <j:TextPrompt
> prompt="Disabled with prompt..."/>
>                                                 <j:Disabled/>
>                                         </j:beads>
>                                 </j:TextInput>
> +
> +                               <j:HGroup gap="3"
> itemsVerticalAlign="itemsSameHeight">
> +                                       <j:TextInput id="textinput">
> +                                               <j:beads>
> +                                                       <j:TextPrompt
> prompt="Slider resize..."/>
> +                                               </j:beads>
> +                                       </j:TextInput>
> +                                       <j:Label text="A label to check
> layout"/>
> +                               </j:HGroup>
> +
> +                               <j:Slider id="slider_w" width="350"
> value="211" minimum="10" maximum="350" valueChange="onValueChange(event)"/>
> +                               <j:Label
> text="textinput.width='{textinput.width}'"/>
>                         </j:Card>
>                 </j:GridCell>
>
> diff --git
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as
> index ad41d99..f3ce7f5 100644
> ---
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as
> +++
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/textinput/TextInputBase.as
> @@ -146,6 +146,7 @@ package
> org.apache.royale.jewel.supportClasses.textinput
>              }
>                 }
>
> +        COMPILE::SWF
>          private var inSetter:Boolean;
>
>          /**
> @@ -158,8 +159,12 @@ package
> org.apache.royale.jewel.supportClasses.textinput
>                  */
>                 public function textChangeHandler(event:Event):void
>                 {
> +            COMPILE::SWF
> +            {
>              if (!inSetter)
>                  dispatchEvent(new Event(Event.CHANGE));
> +            }
> +            dispatchEvent(new Event(Event.CHANGE));
>                 }
>
>          COMPILE::JS
>
>

-- 
Carlos Rovira
http://about.me/carlosrovira