Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 275
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha
My Carrier: -

Problems in Multiline Label: BB10

I want to create a scrollable Lable, that will increase in height at runtime and it should allow the main container to scroll. I am using the Grid layout to allow the lable to allign within container. But the Label is always rendering as single line even if I have added 'maxLines = 0'. But if I add the text with '\n' , it renders correctly with new line and allows the container to scroll. But I don't want to add 'new line characters'. What is wrong in the following code

oMainContainer = new Container();
oMainContainer.scrollDirection = ScrollDirection.VERTICAL;
oMainContainer.height = stage.stageHeight;
oMainContainer.width = stage.stageWidth;
//
var oGridLay:GridLayout = new GridLayout();
oMainContainer.layout = oGridLay;
oGridLay.padding = 30;
//
var oAllignData:GridData = new GridData();
oAllignData.hAlign = Align.BEGIN;
oAllignData.vAlign = Align.FILL;
//
oOutput = new Label();
oOutput.text = "This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. This is sample scrollable text. ";
//oOutput.text = "vsd sda vds av sadv \n adsv ads vsadvds vsd sda vds av sadv \n  adsv ads vsadvds vsd sda vds av sadv \n  adsv ads vsadvds vsd sda vds av \n  sadv adsv ads vsadvds vsd sda vds \n  av sadv adsv ads vsadvds vsd sda vds \n av sadv adsv ads vsadvds vsd sda \n  vds av sadv \n  adsv ads vsadvds vsd sda vds av sadv \n adsv ads vsadvds vsd sda vds av sadv \n  adsv ads vsadvds vsd sda vds av sadv \n  adsv ads vsadvds vsd sda vds av \n  sadv adsv ads vsadvds vsd sda vds \n  av sadv adsv ads vsadvds vsd sda vds \n av sadv adsv ads vsadvds vsd sda \n  vds av sadv \n  adsv ads vsadvds ";
oOutput.maxLines = 0;
oOutput.layoutData = oAllignData;
oMainContainer.addChild(oOutput);
this.addChild(oMainContainer);
Developer
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055
My Carrier: Telus

Re: Problems in Multiline Label: BB10

It looks like you didn't set a width for the label, try setting oOutput.width = oMainContainer.width.

VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox
Developer
Posts: 275
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha
My Carrier: -

Re: Problems in Multiline Label: BB10

I guess, I am not required to set the width as I am using the layout. Even if I set the width, it does not work.

 

Interestingly if I change the layout to 'StackLayout'   and 'StackData', I get the multiline text.

 

Is this an issue with Grid layout, I have to use the label in Grid layout only.

Highlighted
Developer
Posts: 275
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha
My Carrier: -

Re: Problems in Multiline Label: BB10

Hasn't anyone came across this issue?