You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Carlos Rovira <ca...@apache.org> on 2018/09/11 19:12:16 UTC
Re: [royale-asjs] branch develop updated: resize example button
Hi
I make an example where a slider changes size of a button. Then the label
of the button is binding a the width and height of the button. The label in
the button doesn't change
In the other hand, I put as well a label and make the same binding to the
text, and as usual this is changing.
Do you know what could be the problem?
Thanks
El mar., 11 sept. 2018 a las 21:02, <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 e1040d3 resize example button
> e1040d3 is described below
>
> commit e1040d377463496607a9c9cac4936e97ea51ba36
> Author: Carlos Rovira <ca...@apache.org>
> AuthorDate: Tue Sep 11 21:02:39 2018 +0200
>
> resize example button
> ---
> .../src/main/royale/ButtonPlayGround.mxml | 32
> +++++++++++++++++++---
> .../main/royale/org/apache/royale/jewel/Button.as | 8 +++---
> 2 files changed, 32 insertions(+), 8 deletions(-)
>
> diff --git
> a/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml
> b/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml
> index e99c23e..b83a67d 100644
> --- a/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml
> +++ b/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml
> @@ -27,6 +27,13 @@ limitations under the License.
> private function clickHandler(event:MouseEvent):void {
> button.emphasis = (button.emphasis == Button.PRIMARY) ?
> "" : Button.PRIMARY;
> }
> +
> + private function onValueChange(event:Event):void
> + {
> + // trace("onValueChange"); // if target
> IE11 you must use this event handler
> + reizableButton.width = slider_w.value;
> + reizableButton.height = slider_h.value;
> + }
> ]]>
> </fx:Script>
>
> @@ -35,8 +42,8 @@ limitations under the License.
> </j:beads>
>
> <j:Grid gap="true" itemsVerticalAlign="itemsSameHeight">
> - <j:GridCell desktopNumerator="1" desktopDenominator="3"
> - tabletNumerator="1"
> tabletDenominator="1"
> + <j:GridCell desktopNumerator="1" desktopDenominator="2"
> + tabletNumerator="1"
> tabletDenominator="2"
> phoneNumerator="1"
> phoneDenominator="1">
> <j:Card>
> <html:H3 text="Jewel Button"/>
> @@ -53,7 +60,7 @@ limitations under the License.
> </j:Button>
> </j:Card>
> </j:GridCell>
> - <j:GridCell desktopNumerator="1" desktopDenominator="3"
> + <j:GridCell desktopNumerator="1" desktopDenominator="2"
> tabletNumerator="1"
> tabletDenominator="2"
> phoneNumerator="1"
> phoneDenominator="1">
> <j:Card>
> @@ -81,7 +88,9 @@ limitations under the License.
> </j:Button>
> </j:Card>
> </j:GridCell>
> - <j:GridCell desktopNumerator="1" desktopDenominator="3"
> + </j:Grid>
> + <j:Grid gap="true" itemsVerticalAlign="itemsSameHeight">
> + <j:GridCell desktopNumerator="1" desktopDenominator="2"
> tabletNumerator="1"
> tabletDenominator="2"
> phoneNumerator="1"
> phoneDenominator="1">
> <j:Card>
> @@ -99,6 +108,21 @@ limitations under the License.
> </j:IconButton>
> </j:Card>
> </j:GridCell>
> + <j:GridCell desktopNumerator="1" desktopDenominator="2"
> + tabletNumerator="1"
> tabletDenominator="2"
> + phoneNumerator="1"
> phoneDenominator="1">
> + <j:Card>
> + <html:H4 text="Button size"/>
> +
> + <j:HGroup gap="3"
> itemsVerticalAlign="itemsSameHeight">
> + <j:Button id="reizableButton"
> text="Resize {slider_w.value}x{slider_h.value}"
> emphasis="{Button.PRIMARY}"/>
> + <j:Button text="check layout"/>
> + </j:HGroup>
> + <j:Slider id="slider_w" width="350"
> value="96" minimum="10" maximum="350" valueChange="onValueChange(event)"/>
> + <j:Slider id="slider_h" width="350"
> value="38" minimum="10" maximum="350" valueChange="onValueChange(event)"/>
> + <j:Label text="Resize button to:
> '{reizableButton.width}x{reizableButton.height}'"/>
> + </j:Card>
> + </j:GridCell>
> </j:Grid>
>
> </j:SectionContent>
> diff --git
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
> index edd9415..88d284c 100644
> ---
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
> +++
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
> @@ -382,7 +382,7 @@ package org.apache.royale.jewel
> */
> public function get text():String
> {
> - return element.innerHTML;
> + return (element as HTMLButtonElement).innerHTML;
> }
>
> /**
> @@ -390,7 +390,7 @@ package org.apache.royale.jewel
> */
> public function set text(value:String):void
> {
> - this.element.innerHTML = value;
> + (element as HTMLButtonElement).innerHTML = value;
> this.dispatchEvent('textChange');
> }
>
> @@ -404,7 +404,7 @@ package org.apache.royale.jewel
> */
> public function get html():String
> {
> - return element.innerHTML;
> + return (element as HTMLButtonElement).innerHTML;
> }
>
> /**
> @@ -412,7 +412,7 @@ package org.apache.royale.jewel
> */
> public function set html(value:String):void
> {
> - this.element.innerHTML = value;
> + (element as HTMLButtonElement).innerHTML = value;
> this.dispatchEvent('textChange');
> }
>
>
>
--
Carlos Rovira
http://about.me/carlosrovira