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
Highlighted
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)
Accepted Solution

Text Lable being Truncated...?

Hey all.  Jus tmessing around some more with containers.  I've been making a lot of progress on my app, but i have hit a small snag.

 

I have several containers, but here is the relivant code:

 

 

// now we build the footer
			_footer = new Container();
			_footer.margins = Vector.<Number>([5,5,5,5]);
			_footer.flow = ContainerFlow.VERTICAL;
			_footer.debugColor = 0x0000FF;
			_footer.padding = 3;
			_footer.size = 7;
			_footer.sizeUnit = SizeUnit.PERCENT;
			_footer.flow = ContainerFlow.HORIZONTAL;
			_footer.align = ContainerAlign.FAR;				
			_footer.containment = Containment.DOCK_BOTTOM;



		
			
			// create a Text Format for the Footer
			var FooterFormat:TextFormat = new TextFormat();
			//FooterFormat.size = 10;										// set the font size
			
			
			
			// create Label for footer text
			var footerText:Label;										
			footerText = new Label();
			footerText.format = FooterFormat;
			footerText.text = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20";
						
			_footer.addChild(footerText);

 

 

The lable should have the numebrs 1-20 right?  Yeah, thats what i thought.

 

 

Here, though, is a screen shot:

Whats going on?

 

 

Anybody got any idea of why this is happening?

- - - - - - - - - -
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Text Lable being Truncated...?

hey dtater,

 

qnx labels have a default label width of 100 or so. so when you insert text, you have to adjust it's width accordingly or else there will be truncation. a good rule of thumb is adding 5 pixels to the overall width of the text you have in the label. we use either the setSize() method or the width property to adjust the width:

 

 

			footerText = new Label();
			footerText.format = FooterFormat;
			footerText.text = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20";
			footerText.width = footerText.textWidth + 5;

 

 

or (this will adjust both the height and width)

 

 

			footerText = new Label();
			footerText.format = FooterFormat;
			footerText.text = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20";
			footerText.setSize(footerText.textWidth + 5, footerText.textHeight + 5);

 

hope that clears things up. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: Text Lable being Truncated...?

Wow.  I spent a *ton* of time going through the documentation looking for that type of limit.

 

 

You shoudl work for RIM... makign their documentation better.

 

Kudos added!

- - - - - - - - - -
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Text Lable being Truncated...?

haha thanks dtater! if it only were that easy Smiley Happy

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 1,003
Registered: ‎01-16-2011
My Device: PlayBook (sim)
My Carrier: Rogers

Re: Text Lable being Truncated...?

I'm gonna add a kudo for that as well - I knew it was cut off due to labels been a determine size, I just always guessed at how big my text was. Wasn't aware I could put in a text width command to make it bigger.
- If you like my response/post, or it helped you find an answer you were looking for, please provide a Kudo - white star to the bottom right of this post. -
- Please use the search bar at the top, or check out the PlayBook FAQ's for help getting started -
- Hockey DrillBook -