robp
robp

Reputation: 58

Spark Scroller, limit to vertical scrolling

I have a Spark Scroller within my View because I have a lot of content and require vertical scrolling. I current have some labels that get data from my dataProvider, and the strings are sometimes long. I'd like the label to be multiline, but because everything is currently in a Scroller that does both x and y scrolling, the label never uses the maxDisplayedLines property and stretches the entire viewport out to the required size.

<s:Scroller left="10" right="10" top="10" bottom="0">
 <s:Group>
  <s:VGroup>
   <s:HGroup>
    <s:Label text="Name: "/>
    <s:Label text="{data.name}"/>
   </s:HGroup>
   <s:HGroup>
    <s:Label text="Description: "/>
    <s:Label text="{data.description}" maxDisplayedLines="-1"/> // This pushes everything out, I want it to not expand the content horizontally beyond the width
   </s:HGroup>
   ...
  </s:VGroup>
 </s:Group>
</s:Scroller>

Any help is appreciated. Thanks.

Upvotes: 1

Views: 2204

Answers (2)

Wade Mueller
Wade Mueller

Reputation: 6059

You need to establish a width on your containers/components so it all measures properly. This worked for me:

<s:Scroller left="10" right="10" top="10" bottom="0">
 <s:Group width="100%">
  <s:VGroup width="100%">
   <s:HGroup width="100%">
    <s:Label text="Name: "/>
    <s:Label text="{data.name}"/>
   </s:HGroup>
   <s:HGroup width="100%">
    <s:Label text="Description: "/>
    <s:Label width="100%" text="{data.description}" maxDisplayedLines="-1"/> // This pushes everything out, I want it to not expand the content horizontally beyond the width
   </s:HGroup>
   ...
  </s:VGroup>
 </s:Group>
</s:Scroller>

Upvotes: 2

chchrist
chchrist

Reputation: 19802

Use horizontalScrollPolicy="off"

Upvotes: 2

Related Questions