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: 48
Registered: ‎09-08-2013
My Device: Z10
My Carrier: None
Accepted Solution

top half of textInput is not visible

So i'm working around the text input issue using qnxui.swc and QNXSKins.ane in Flash Professional CS6. Now the top half of the text in my inputText field is not visible on the BlackBerry Z10.

 

It works just fine when tested in Control/Test Movie/In AIR Debug Launcher (Mobile) but after being installed on the BlackBerry Z10 the textFormat makes the top half of the text disappear. Without textFormat the text is 8pt tiny.

 

 

import qnx.fuse.ui.text.TextInput;
import qnx.fuse.ui.text.TextFormat;
import qnx.fuse.ui.text.TextInputIconMode;

 

 

public var inputField:qnx.fuse.ui.text.TextInput = new TextInput();

 


format = new TextFormat();
format.minSize = 20 * screenscale;
format.color = 0x000000;
format.font = "Arial";
format.bold = true;


instformat = new TextFormat();
instformat.minSize = 20 * screenscale;
instformat.color = 0x999999;
instformat.font = "Arial";
instformat.bold = true;

inputField.format = instformat;
inputField.addEventListener(FocusEvent.FOCUS_IN, blackinputtxt);
inputField.addEventListener(KeyboardEvent.KEY_DOWN, checkenter);
inputField.width = 200;
inputField.height = 100;
inputField.text = thisname;
trace(inputField.textHeight);
inputField.clearIconMode = TextInputIconMode.UNLESS_EDITING;
inputField.x = s140;
inputField.y = 20;
inputField.maxChars = 11;
inputField.restrict = "A-Za-z0-9";
addChild(inputField);

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: top half of textInput is not visible

Try commenting out the height=100 item. If that does not work, try commenting out minSize in the TextFormat.

guesses since everything else looks ok.
Contributor
Posts: 48
Registered: ‎09-08-2013
My Device: Z10
My Carrier: None

Re: top half of textInput is not visible

tried it but the textInput seems to be refusing to let go of the default 8pt text size no matter what the textFormat specifies.

Highlighted
Contributor
Posts: 48
Registered: ‎09-08-2013
My Device: Z10
My Carrier: None

Re: top half of textInput is not visible

[ Edited ]

Thanks for the nudge in the right direction. Apparently textInput.format must be defined after textInput.text. Also, don't use textInput.prompt as I could not resolve the issue with prompt. This is the only way I could get textInput to work without using the space hack. I'm assuming this will be backward compatible with the older BlackBerry OS 10 The textFormat cannot change any text properties except color.

 

package
{

import flash.display.MovieClip;
import qnx.fuse.ui.text.TextInput;
import qnx.fuse.ui.text.TextFormat;
import qnx.fuse.ui.text.TextInputIconMode;
import qnx.fuse.ui.text.TextInputBase;
import qnx.fuse.ui.text.TextFormatStyle;

 

public class textinputfix extends MovieClip
{

public var inputField:qnx.fuse.ui.text.TextInput = new TextInput();
var format:TextFormat;
var instformat:TextFormat;

 

public function textinputfix():void
{


format = new TextFormat();
format.color = 0x000000;

instformat = new TextFormat();
instformat.color = 0x999999;


}


public function enterplayername(thisnameSmiley Frustratedtring):void
{


var displaytext = thisname;
inputField.addEventListener(FocusEvent.FOCUS_IN, blackinputtxt);
inputField.addEventListener(KeyboardEvent.KEY_DOWN, checkenter);
inputField.width = 200;
inputField.height = 50;
inputField.text = displaytext;
inputField.clearIconMode = TextInputIconMode.UNLESS_EDITING;
inputField.x = 140;
inputField.y = 20;

inputField.maxChars = 11;
inputField.restrict = "A-Za-z0-9";
inputField.format = instformat;
addChild(inputField);

 

}


public function blackinputtxt(e:Event):void
{


inputField.removeEventListener(FocusEvent.FOCUS_IN, blackinputtxt);
inputField.text = "";
inputField.format = format;


}


public function checkenter(e:KeyboardEvent):void
{


if (e.charCode == 13)
{


stage.focus = null;
inputField.removeEventListener(KeyboardEvent.KEY_DOWN, checkenter);
setplayername();


}

}

}

 

This way you can pass a string "User Instructons" to inputText and it will appear grey. Once the user taps the inputText field, the instructions will disappear and the text input by the user will appear black.