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/03/14 16:04:55 UTC
Change layout at runtime is not possible
Hi
I tried to change the gap of a vertical layout at runtime using a Slider
that change gap value:
<fx:Script>
<![CDATA[
private function onValueChange(event:Event):void
{
vlg.gap = slider_gap.value;
}
]]>
</fx:Script>
<js:beads>
<js:VerticalLayoutWithPaddingAndGap id="vlg" gap="10"/>
</js:beads>
<j:Slider id="slider_gap" width="250" value="10" minimum="0" maximum=
"100"
valueChange="onValueChange(event)"/>
But this not work.
Seems that layout once is set can't be changed, or there's no call of type
"doLayout" or something like this after setup again the gap value. I tried
to recall "layout()" method to see what happen but gives error
TypeError: undefined is not an object (evaluating 'this.host.getLayoutHost')
Is out layout system not prepared to do this or there's a way to call a
relayout in some way after set gap or padding in a layout class?
thanks
--
Carlos Rovira
http://about.me/carlosrovira
Re: Change layout at runtime is not possible
Posted by Carlos Rovira <ca...@apache.org>.
ok thanks Alex,
I'll search fo it in the code
2018-03-14 17:42 GMT+01:00 Alex Harui <ah...@adobe.com.invalid>:
> In PAYG, that would be another bead. Not all UI is dynamic and dynamic
> support usually requires more code. There is a LayoutChangeNotifier bead
> that watches a value and dispatches an event that will cause re-layout in
> layouts that are listening.
>
> And you can subclass VerticalLayoutWithPaddingAndGap and bake the change
> detection and re-layout into a new dynamic layout if you wish.
>
> HTH,
> -Alex
>
> On 3/14/18, 9:04 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:
>
> >Hi
> >
> >I tried to change the gap of a vertical layout at runtime using a Slider
> >that change gap value:
> >
> ><fx:Script>
> > <![CDATA[
> >private function onValueChange(event:Event):void
> >{
> > vlg.gap = slider_gap.value;
> >}
> > ]]>
> > </fx:Script>
> >
> > <js:beads>
> > <js:VerticalLayoutWithPaddingAndGap id="vlg" gap="10"/>
> > </js:beads>
> >
> > <j:Slider id="slider_gap" width="250" value="10" minimum="0" maximum=
> >"100"
> > valueChange="onValueChange(event)"/>
> >
> >But this not work.
> >
> >Seems that layout once is set can't be changed, or there's no call of type
> >"doLayout" or something like this after setup again the gap value. I tried
> >to recall "layout()" method to see what happen but gives error
> >
> >TypeError: undefined is not an object (evaluating
> >'this.host.getLayoutHost')
> >
> >Is out layout system not prepared to do this or there's a way to call a
> >relayout in some way after set gap or padding in a layout class?
> >
> >thanks
> >
> >--
> >Carlos Rovira
> >https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fabout.me%2
> >Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%
> 7C417da01f8a18406d1b1a08d5
> >89c5640e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%
> 7C636566403233451178&s
> >data=L1izMcsHOvUc54KbxjBUL7OSUxSIE3oBDjviSFhbCs8%3D&reserved=0
>
>
--
Carlos Rovira
http://about.me/carlosrovira
Re: Change layout at runtime is not possible
Posted by Alex Harui <ah...@adobe.com.INVALID>.
In PAYG, that would be another bead. Not all UI is dynamic and dynamic
support usually requires more code. There is a LayoutChangeNotifier bead
that watches a value and dispatches an event that will cause re-layout in
layouts that are listening.
And you can subclass VerticalLayoutWithPaddingAndGap and bake the change
detection and re-layout into a new dynamic layout if you wish.
HTH,
-Alex
On 3/14/18, 9:04 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:
>Hi
>
>I tried to change the gap of a vertical layout at runtime using a Slider
>that change gap value:
>
><fx:Script>
> <![CDATA[
>private function onValueChange(event:Event):void
>{
> vlg.gap = slider_gap.value;
>}
> ]]>
> </fx:Script>
>
> <js:beads>
> <js:VerticalLayoutWithPaddingAndGap id="vlg" gap="10"/>
> </js:beads>
>
> <j:Slider id="slider_gap" width="250" value="10" minimum="0" maximum=
>"100"
> valueChange="onValueChange(event)"/>
>
>But this not work.
>
>Seems that layout once is set can't be changed, or there's no call of type
>"doLayout" or something like this after setup again the gap value. I tried
>to recall "layout()" method to see what happen but gives error
>
>TypeError: undefined is not an object (evaluating
>'this.host.getLayoutHost')
>
>Is out layout system not prepared to do this or there's a way to call a
>relayout in some way after set gap or padding in a layout class?
>
>thanks
>
>--
>Carlos Rovira
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2
>Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C417da01f8a18406d1b1a08d5
>89c5640e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636566403233451178&s
>data=L1izMcsHOvUc54KbxjBUL7OSUxSIE3oBDjviSFhbCs8%3D&reserved=0