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: 47
Registered: ‎06-27-2010
My Device: Bold 9700
My Carrier: AT&T

Multiline TextInput

Is there a way to make a qnx multiline text input component?

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

Re: Multiline TextInput

hey kmbauer,

 

there isnt a QNX native-specific class for a multiline textinput but adobe does have one in its libraries. Here is a thread regarding multiline text input we were working on a few weeks back started by Harry:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/TextField-testing/m-p/657751#M167...

 

it should be what you are looking for. let me know how it turns out. 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: 192
Registered: ‎09-23-2009
My Device: 9860/PlayBook/Dev Alpha
My Carrier: Plus GSM

Re: Multiline TextInput

Maybe there is a better way. Make your TextInput at large height, then change multiline property to true on this TextInput property: textField this should turn multiline behavior on TextInput field. Didn't tested, but seems reasonable.

Found my post helpfull? Like it! It solves your trouble? Help others and accept it as solution. Search before asking.
My apps: Secret Cod3s | Should my tablet be banned?
--
Jakub Nietrzeba
PGS Software S.A.
Your reliable partner in Poland - IT Outsourcing - BlackBerry, iPhone, Web and Standalone applications
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Multiline TextInput

hey gluth,

 

thats a good approach and would work like a charm except when there is an overflow a scroll bar doesnt come up and the text simply goes over the control textinput control and onto the background. we could resize it based on the textHeight from the textField object but it'd have its limits (interfering with other controls, etc). also when i do apply a larger height to the TextInput the text still can only be edited in the middle region and not hte top as expected. there is probably a work around but ill keep hunting.

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
Highlighted
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Multiline TextInput

[ Edited ]

Hey im back and i've hunted.

 

here's what i've found. i've tried several approaches and all seem to point to only one solution. the reason why a text area with scrolling wouldnt work is because when a user clicks on a textinput it automatically assumes they want to type something so you can drag it down as you would a scroll pane. thats my assumption. even tried to plug in a scrollpane and shift the textField around. So the best bet and to stick with the QNX native AIR APIs is creating a large enough TextInput object that can hold the text you want. The following code will show you how to do it and even fixes the overflowing problem (text goes over the bounds of the control). so here you go hope its what you are looking for!

 

 

package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.geom.Rectangle;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	import qnx.ui.text.Label;
	import qnx.ui.text.TextInput;
	
	[SWF(width="1024",height="600",backgroundColor="#CCCCCC",frameRate="30")]
	public class TextInputTest extends Sprite
	{
		private var myInput:TextInput;
		
		public function TextInputTest()
		{
			super();
			
			// support autoOrients
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			myInput = new TextInput();
			myInput.setSize(500, 200);
			
			/*
			 * Must be call or else it cuts off the TextField Label
			 * and does not position the text properly. Allows the 
			 * textField object ot have breathing room.
			*/
			myInput.autoSize = TextFieldAutoSize.LEFT;
			
			/*
			 * Adding this line sets the textfield near the top of the
			 * TextInput object. The first and second number (-10)
			 * is where the the rectangle starts. It seems to follow
			 * a wierd coordinate plane but -10 seems to be the sweet
			 * spot. Adjust accordingly. This also prevents any text from
			 * overflowing over the TextInput control.
			*/
			myInput.textField.scrollRect = new Rectangle(-10,-10,490,190);
			
			/*
			 * Set the multiline property of the textField object to true for carriage
			 * returns and set the wordWrap value to true to allow the words to wrap
			 * and not go over the control.
			*/
			myInput.textField.multiline = true;
			myInput.textField.wordWrap = true;
			
			addChild(myInput);
			
		}

	}
}

 

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: 327
Registered: ‎12-13-2010
My Device: Bold 9900/Z10 Special Edition
My Carrier: Rogers

Re: Multiline TextInput

[ Edited ]

I've found an issue with your fix rJab


You can only click into the TextInput object on the first line (where it would be if it were only 1 line as it is normally)


If you try to click into it when it's empty below the "first line" it doesn't click in....I was thinking the code was broken or something because at first I wasn't able to activate the input at all then I realized I needed to click where the first line is....


It's fine when there is already multiple lines of text but I don't plan on having it full to start!

CEO/Lead Developer - Tensioncore™ Design Studios
http://tncr.ws/ - ShortenThis!™ for Blackberry Playbook | ShortenThis!™ for BlackBerry® 10
The Periodical Toe A highly informative Table of Elements
DrawThis! A fun drawing app for the BlackBerry® PlayBook™!
http://www.tensioncore.com/ - Tensioncore™ Web Hosting
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Multiline TextInput

hey tensioncore,

 

thanks for the follow up. i was aware of the short coming of the code posted. still havent quite figured out how to make the textfield inside the TextInput object as large as the TextInput area initially. eventually when we get access to the PPS related class (or use Darkin's approach) we'll be able to set focus based on a tap and set it to the textfield inside no matter where they press and pop up the keyboard.

 

that or hope they make a true multiline TextInput class 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: 232
Registered: ‎01-30-2011
My Device: Dev Alpha C, Z10 LE
My Carrier: P4

Re: Multiline TextInput

 
All time online Smiley Very Happy
Trusted Contributor
Posts: 107
Registered: ‎04-08-2011
My Device: BlackBerry Q10
My Carrier: Mobilink

Re: Multiline TextInput

One mroe problem guys, once you type a lot of text and the text height goes more than the InputText height, it starts disappearing.

 

I think we'll have to adjust the X location of textField dynamically . I'll try it out and post here if it works out.

 

 

Get Speedometer on your phone. http://www.speedometer.mobi
Developer
Posts: 1,003
Registered: ‎01-16-2011
My Device: PlayBook (sim)
My Carrier: Rogers

Re: Multiline TextInput

I found that I could contain the text within the horizontal bounds of my textInput using multiline and word-wrap, but once I had more lines than the size of the box it simply over flowed above the vertical bounds (top and bottom). I submitted this as a feature request, to have a scrollable text input QNX component, unless someone knows of a solution I've overlooked.
- 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 -