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
Contributor
Posts: 20
Registered: ‎05-08-2011
My Device: developer
My Carrier: none

TextInput format sizes over 20 get cut

The qnx.ui TextInput component cuts off texts formated with sizes bigger than 20 (depending on the font).
Setting textField.autoSize does not fix the problem.


http://twitpic.com/4v6ber

 

 

 

package  
{
	import flash.display.Sprite;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import qnx.ui.text.TextInput;
	
	[SWF(width="1024", height="600", backgroundColor="#cccccc", frameRate="30")]
	
	public class TextInputExample extends Sprite 
	{
		
		public function TextInputExample() 
		{
			var textInput:TextInput;
			
			textInput = new TextInput();
			textInput.format = new TextFormat("Arial", 30, 0);
			textInput.setPosition(20, 20);
			textInput.setSize(300, 65);
			addChild(textInput);
			
			textInput = new TextInput();
			textInput.format = new TextFormat("Arial", 30, 0);
			textInput.textField.autoSize = TextFieldAutoSize.LEFT;
			textInput.setPosition(20, 100);
			textInput.setSize(300, 65);
			addChild(textInput);
		}
		
	}

}

 

Any ideas how to work around this?

Maybe extending TextInput and overriding some key methods?
Is there any documentation for the qnx protected methods?

Thanks.

 

 

Highlighted
Contributor
Posts: 20
Registered: ‎05-08-2011
My Device: developer
My Carrier: none

Re: TextInput format sizes over 20 get cut

I have found a work around for this:
- create a class MyTextInput that extends TextInput
- override protected method getTextRect()
- set rect.height = text input's height

It is silly. Should definitelly be part of the of the original component. It is nonsense to have a skinnable component with a fixed text height. Anyway, until they fix it, I hope this helps other people with the same problem.



package flagin.ui 
{
	import flash.geom.Rectangle;
	import qnx.ui.text.TextInput;
	
	public class MyTextInput extends TextInput 
	{
		
		public function MyTextInput() 
		{
			
		}
		
		override protected function getTextRect():Rectangle
		{
			var rect:Rectangle;
			
			rect = super.getTextRect();
			rect.height = height;
			
			return rect;
		}
		
	}

}

 

 

Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: TextInput format sizes over 20 get cut

please submit this as a bug (i agree, it's really stupid).

 

also note that the TextInput's autoSize property has been depreciated since SDK 1.0.1.


PlayBook Applications:
Drop Swatch
Contributor
Posts: 18
Registered: ‎02-24-2011
My Device: Not Specified

Re: TextInput format sizes over 20 get cut

When I implement this into my existing .as file, I get the error:

 

A file found in a source-path can not have more than one externally visible definition. flagin.ui:MyTextInput

 

What stupid thing am I doing here?

Contributor
Posts: 18
Registered: ‎02-24-2011
My Device: Not Specified

Re: TextInput format sizes over 20 get cut

Can you guys expand on this a little bit?  I am having a heck of a time getting this to work and my text not to be cut off.  I did what I mentioned above as well as also creating a new .as file in my project and creating this class.  I then tried calling MyTextInput instead of TextInput in my main .as file, but it just barked at me and says MyTextInput was undefined.

 

How is everyone else getting around this?  Just staying at or below size 20 text?

Contributor
Posts: 20
Registered: ‎05-08-2011
My Device: developer
My Carrier: none

Re: TextInput format sizes over 20 get cut

There is not much more to it. What you need to do is to create an extention of qnx TextInput and override thr protected method getTextRect() like it was described in the post above.

Then every time you need a TextInput, you instantiate this class you just created. It doesn't have to be called MyTextInput or be in any especific package. You can call it anything. And override other methods as well if you think you need to.

So if you do decide to call your class MyTextInput(), then just go:

var inputField:MyTextInput;

inputField = new MyTextInput();
inputField.setPosition(1, 60);
inputField.setSize(280, 60);
addChild(inputField);

 

Contributor
Posts: 20
Registered: ‎05-08-2011
My Device: developer
My Carrier: none

Re: TextInput format sizes over 20 get cut

Just published a blog post with tips & tricks about skinning PlayBook components:
http://brunoimbrizi.com/unbox/2011/06/skinning-playbook-components/

BlackBerry Development Advisor
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: TextInput format sizes over 20 get cut

Was a bug ever submitted for this? I have a fix for the issue and I want to make sure the proper bug gets updated.

Contributor
Posts: 20
Registered: ‎05-08-2011
My Device: developer
My Carrier: none

Re: TextInput format sizes over 20 get cut

No, I haven't submitted a bug (I didn't know where to do it).
But I'm glad there is a fix =)

Cheers.

BlackBerry Development Advisor
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: TextInput format sizes over 20 get cut

Here is the link to the bug tracker.

 

http://us.blackberry.com/developers/resources/issuetracker/

 

If you find any bugs, please log one with a test case. We will try and fix it as soon as we can.