PDA

View Full Version : view width and bgcolor


dehian
02-01-2010, 12:16 AM
let's have a look at the following code

<canvas>
<simplelayout axis="y" spacing="20"/>

<view name="test1">
<simplelayout axis="y" spacing="2"/>
<text text="aa" bgcolor="blue" width="100%"/>
<text text="bbbbbbbbbbbbbbbbbbbbbbb" bgcolor="yellow" width="100%"/>
</view>

<view name="test2">
<simplelayout axis="y" spacing="2"/>
<text text="bbbbbbbbbbbbbbbbbbbbbbb" bgcolor="blue" width="100%"/>
<text text="aa" bgcolor="yellow" width="100%"/>
</view>

<view name="test3" hassetwidth="true">
<simplelayout axis="y" spacing="2"/>
<text text="aa" bgcolor="blue" width="100%"/>
<text text="bbbbbbbbbbbbbbbbbbbbbbb" bgcolor="yellow" width="100%"/>
</view>
</canvas>

the output looks like this
http://30millionsdelapins.be/laszlo2.JPG
i'd like the output to look like this
http://30millionsdelapins.be/laszlo.jpg
How can i do this?

madtux666
02-01-2010, 07:32 AM
I was to lazy to investigate your code, so I might be wrong :cool: But it look like you have to specify resize attribute for text component:
resize="false"

Andy_Weal
02-01-2010, 11:08 AM
<view name="test2" width="100%" >
<simplelayout axis="y" spacing="2"/>
<text text="bbbbbbbbbbbbbbbbbbbbbbb" bgcolor="blue" width="90%"/>
<text text="aa" bgcolor="yellow" width="100%"/>
</view>



Cheers
Andy

dehian
02-01-2010, 11:30 PM
I was to lazy to investigate your code, so I might be wrong :cool: But it look like you have to specify resize attribute for text component:
resize="false"
I tried with the resize attribute but it didn't work

dehian
02-01-2010, 11:31 PM
<view name="test2" width="100%" >
<simplelayout axis="y" spacing="2"/>
<text text="bbbbbbbbbbbbbbbbbbbbbbb" bgcolor="blue" width="90%"/>
<text text="aa" bgcolor="yellow" width="100%"/>
</view>



Cheers
Andy

I don't want it to be 100% width
i only want it to fit the text's length
do you see what i mean?

thanks anyway

dehian
02-02-2010, 01:26 AM
pydyp found this solution

<view name="test">
<simplelayout axis="y" spacing="2"/>
<text text="aa" bgcolor="blue" width="100%" oninit="if (parent.width &lt; this.getTextWidth()) parent.setAttribute('width',this.getTextWidth());"/>
<text text="bbbbbbbbbbbbbbbbbbbbbbb" bgcolor="yellow" width="100%" oninit="if (parent.width &lt; this.getTextWidth()) parent.setAttribute('width',this.getTextWidth());"/>
</view>

thanx anyway

senshi
02-09-2010, 06:47 AM
[...]
<view name="test3" hassetwidth="true">
<simplelayout axis="y" spacing="2"/>
<text text="aa" bgcolor="blue" width="100%"/>
<text text="bbbbbbbbbbbbbbbbbbbbbbb" bgcolor="yellow" width="100%"/>
</view>
[...]


By setting "hassetwidth" to true, you're effectively disabling the automatic resizing functionality of the view..