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
jansensan
Posts: 30
Registered: ‎04-04-2012
My Device: BlackBerry Playbook
My Carrier: Telus
Accepted Solution

BB10 Dev Alpha LabelButton and TextInput are unbelievably small

I tried doing a simple app for BB10 Dev Alpha recently, but it seems that the UI is weirdly small on instantiation. Why is that? I'd rather avoid having to set dimensions on each items.

 

Check it out:

 

bb10-small-ui.jpg

 

The UI elements have this height only because I set it so, otherwise it'd be as small as the text. What gives?

 

You can see the code here: https://github.com/jansensan/quick-ratio-calculator-bb10/blob/master/src/net/jansensan/qrc/bb10/view...

 

I have used qnx.ui.buttons.LabelButton and qnx.ui.text.TextInput otherwise I get an error that there is no constructor.

 

Anyone can guide me?

--
mat janson blanchet
twitter: @jansensan, portfolio: http://jansensan.net/portfolio, tech blog: http://jansensan.net
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

Try using the fuse controls.  Had no problems.

Please use plain text.
Contributor
jansensan
Posts: 30
Registered: ‎04-04-2012
My Device: BlackBerry Playbook
My Carrier: Telus

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

As I stated in my question, the fuse package does not work, I obtain an error:

 

Exception fault: TypeError: Error #1007: Instantiation attempted on a non-constructor.

at qnx.fuse.ui.text::EditableText$cinit()

at global$init()[E:\hudson\workspace\BB10_0_09-AIR_SDK_API\src\qnxui\src\qnx\fuse\ui\text\EditableText.as:79]

at global$init()[E:\hudson\workspace\BB10_0_09-AIR_SDK_API\src\qnxui\src\qnx\fuse\ui\text\TextInput.as:521]

--
mat janson blanchet
twitter: @jansensan, portfolio: http://jansensan.net/portfolio, tech blog: http://jansensan.net
Please use plain text.
Developer
pyth
Posts: 489
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

if you still work with the old qnx components/SDKs on BB10, you need to set the format. Unfortunately, directly setting myButton.format = ... and myTextInput.format = ... won't work, so try this

 

var myTextFormat:TextFormat = new TextFormat(//whatever you need in here, soze, font, color, etc.
);

var _button1:LabelButton = new LabelButton;
_button1.label = "Hello";
_button1.width = myWidth;
_button1.height = myHeight;
_button1.setTextFormatForState(myTextFormat, SkinStates.UP);
_button1.setTextFormatForState(myTextFormat, SkinStates.DOWN);
_button1.setTextFormatForState(myTextFormat, SkinStates.SELECTED);
_button1.setTextFormatForState(myTextFormat, SkinStates.DISABLED);

 for textinput, it's worse, you need to extend the textinput class and override a method to be able to use myTextFormat.format = ...

 

import flash.geom.Rectangle;
import qnx.ui.text.TextInput;

public class BetterTextInput extends TextInput {

    	public function BetterTextInput()
		{

		}

		override protected function getTextRect():Rectangle
		{
			var rect:Rectangle;

			rect = super.getTextRect();
			rect.height = height;

			return rect;
		}
}






//and in your main where you use BetterTextInput
var myTextInput:TextInput = new BetterTextInput();
myTextInput.format = myTextFormat

 

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Please use plain text.
Contributor
jansensan
Posts: 30
Registered: ‎04-04-2012
My Device: BlackBerry Playbook
My Carrier: Telus

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

That's a lot of work, I'd rather know why using the fuse package doesn't work and fix what is relative to that.

--
mat janson blanchet
twitter: @jansensan, portfolio: http://jansensan.net/portfolio, tech blog: http://jansensan.net
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

I normally do not set the height of the text input controls so it will default to the device skin resolution.

When you simply add a text input from
import qnx.fuse.ui.text.TextInput;
And not do anything to it (other than add it as a child), does that work?
Please use plain text.
Developer
pyth
Posts: 489
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

test what jtegen said, and also, how did you instantiate the fuse components?

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Please use plain text.
Contributor
jansensan
Posts: 30
Registered: ‎04-04-2012
My Device: BlackBerry Playbook
My Carrier: Telus

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

@jtgen & @pyth: I simply create an instance of each UI element. As I said in my original question, you can view the code here: https://github.com/jansensan/quick-ratio-calculator-bb10/blob/master/src/net/jansensan/qrc/bb10/view...

 

I'm not doing anything fancy, I just instanciante a TextInput and a LabelButton. If I use the fuse package, I get an error that there is no constructor: 

 

Exception fault: TypeError: Error #1007: Instantiation attempted on a non-constructor.

at qnx.fuse.ui.text::EditableText$cinit()

at global$init()[E:\hudson\workspace\BB10_0_09-AIR_SDK_API\src\qnxui\src\qnx\fuse\ui\text\EditableText.as:79]

at global$init()[E:\hudson\workspace\BB10_0_09-AIR_SDK_API\src\qnxui\src\qnx\fuse\ui\text\TextInput.as:521]

 

I'm pretty much about to give up here.

--
mat janson blanchet
twitter: @jansensan, portfolio: http://jansensan.net/portfolio, tech blog: http://jansensan.net
Please use plain text.
Developer
UberschallSamsara
Posts: 1,015
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

Can you dump your xml files and any asset files into your repo so other can pull, build and debug?

Please use plain text.
Contributor
jansensan
Posts: 30
Registered: ‎04-04-2012
My Device: BlackBerry Playbook
My Carrier: Telus

Re: BB10 Dev Alpha LabelButton and TextInput are unbelievably small

Everything is committed to the repository now. I work with FDT, if that's any help.

--
mat janson blanchet
twitter: @jansensan, portfolio: http://jansensan.net/portfolio, tech blog: http://jansensan.net
Please use plain text.