12-31-2012 08:01 PM
Hi Everyone,
I'm hoping I'm overlooking something small and sincerely appreciate any help.
Brief version of problem:
When I add a skin to a TextInput object, assign a skin, I cannot change the text-format colour. If I remove the skin it works. And the skin appears to be working properly. The skin class appears to not contain forground font colour controls.
How can I change the background and forground colour of a TextInput for BB10 using the AS3 Gold BB10 sdk?
Long version:
Using: import qnx.fuse.ui.text.TextInput;
I have an application with 12 different themes. In the application I want the TextInput box to inherit the theme settings.
Normally, I can use the following to set a format. And it works on its own.
var a:TextInput = newTextInput;
var b:TextFormat = newTextFormat;
b.color = 0xFF0000;
a.format = b;
However, in order to assign a background colour to the TextInput I needed to create a custom class...
public class myTextInputSkin extends UISkin
Which has a bunch of vars:
protected var upSkin
prite;
protected var focusSkin
prite;
protected var downSkin
prite;
protected var disabledSkin
prite;
public var borderSize:uint = 2;
Which also works great on its own to override the background. However, once I assign the UISkin to the TextInput, it prevents the format from ever being applied to the TextInput.
var a:TextInput = newTextInput;
var b:TextFormat = newTextFormat;
a.setSkin(myTextInputSkin);
b.color = 0xFF0000;
a.format = b;
No matter how I trace it out, it looks like format is applied to the object and the skin is applied to the object. Looking deeper at the TextInput function, it has a TextField buried into it. I can confirm that setting format does reach the TextField buried inside the TextInput, meaning the format really should be changing. I've even tried manually triggering the update font colours event inside the Text Input?
Anyway,
I'm now at a bit of a loss and I feel like I'm missing something stupid and simple. Anyone have any thoughts?
Ed.
Solved! Go to Solution.
01-04-2013 09:23 AM
I've written it off as another FUSE UI bug.
I decided just to rebuild their class from scratch to bypass the problem.
I also rebuilt the IconButton class so that I can have the icons stretch fully across the butons, as well as having more control over colours and imaging.
I'm happy with it for now. But for future refernce for other developers:
Assigning a Skin to a FUSE UI Text Input box will result in a loss of format for the textinput
01-04-2013 02:34 PM
Thanks for bringing this up. This will be fixed in the next SDK release.
To workaround the issue you can use the following subclass.
import qnx.fuse.ui.text.TextInput;
import qnx.fuse.ui.utils.StyleUtils;
public class CustomTextInput extends TextInput
{
override protected function getStyleApplier() : Function
{
return StyleUtils.applyStyleToComponent(this);
}
}
01-07-2013 11:53 PM
Thanks!
For now, I've "unskinned" those elements. Once it gets patched, I'll re-investigate.
Ed