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: 297
Registered: ‎10-30-2010
My Device: PlayBook
My Carrier: other

TextInput Prompt Text Location

[ Edited ]

I've been trying so hard to move the location of a multiline TextInput's 'prompt' textField.

 

I tried tinkering with y, matrix, scrollRect.. But it is stubbornly stuck in the middle. I am trying to move it so that it shows up in the top area of the TextInput, instead of middle. Any ideas?

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

Re: TextInput Prompt Text Location

hey,

 

to fix that problem do the following:

 

 

var myInput:TextInput = new TextInput();

(...)

myInput.getChildAt(2).y = 10;

 

that should do the trick. 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: 297
Registered: ‎10-30-2010
My Device: PlayBook
My Carrier: other

Re: TextInput Prompt Text Location

I've tried it already but that doesnt seem to work.. :smileysurprised:
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: TextInput Prompt Text Location

hey,

 

it should work. it worked on my end without a hitch. here's the exact code i used to test it:

 

 

package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.geom.Rectangle;
	import flash.text.TextFieldAutoSize;

	import qnx.ui.text.TextInput;
	
	[SWF(width="1024",height="600",backgroundColor="#666666",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(300,200);
			myInput.prompt = "Insert some comments here...";
			myInput.setPosition(10,10);
			
			myInput.autoSize = TextFieldAutoSize.LEFT;
			myInput.textField.scrollRect = new Rectangle(-10,-10,290,190);
			
			myInput.textField.wordWrap = true;
			myInput.textField.multiline = true;
			
			myInput.getChildAt(2).y = 10;
			
			addChild(myInput);			
				
		}
	}
}

 

 

and here are the screen shots showing the out put on both the AIR Desktop debugger and the Simulator:

 

AIR Desktop:

 

Screen shot 2010-12-28 at 7.32.03 PM.png

 

Simulator:

 

Screen shot 2010-12-28 at 7.34.08 PM.png

 

the screen shots i posted will take some time to show up (pending approval from a moderator). but for now run the code i posted above and see if you get the same result i did. there should be a prompt that reads "insert comments here..." when you compile and run it.

 

also what is the rest of your code? maybe you are doing soemthing different with your TextInput that is changing the order of children within the TextInput object. hope this helps. 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: 297
Registered: ‎10-30-2010
My Device: PlayBook
My Carrier: other

Re: TextInput Prompt Text Location

[ Edited ]

I finally figured out was causing my problem.

 

Changing the width or height of the TextInput resets the y position of the prompt textField! I never suspected width would have affected the vertical position of the prompt Textfield :mansurprised: