11-06-2012 12:00 PM
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:
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-calculato
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?
Solved! Go to Solution.
11-06-2012 04:31 PM
Try using the fuse controls. Had no problems.
11-06-2012 07:37 PM
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\qnxu
at global$init()[E:\hudson\workspace\BB10_0_09-AIR_SDK_API\src\qnxu
11-07-2012 02:29 AM
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
11-07-2012 09:50 AM
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.
11-07-2012 10:04 AM
11-08-2012 03:37 AM
test what jtegen said, and also, how did you instantiate the fuse components?
11-08-2012 05:10 PM
@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-calculato
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_SD
at global$init()[E:\hudson\workspace\BB10_0_09-AIR_SD
I'm pretty much about to give up here.
11-08-2012 05:54 PM
Can you dump your xml files and any asset files into your repo so other can pull, build and debug?
11-08-2012 06:16 PM
Everything is committed to the repository now. I work with FDT, if that's any help.