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
KermEd
Posts: 169
Registered: ‎05-18-2009
My Device: NA
My Carrier: NA
Accepted Solution

AS3 / AIR - BB10 Problem: TextInput, Skinning and Format

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:smileyfrustrated:prite;

protected var focusSkin:smileyfrustrated:prite;

protected var downSkin:smileyfrustrated:prite;

protected var disabledSkin:smileyfrustrated: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.

Please use plain text.
Developer
KermEd
Posts: 169
Registered: ‎05-18-2009
My Device: NA
My Carrier: NA

Re: AS3 / AIR - BB10 Problem: TextInput, Skinning and Format

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

Please use plain text.
BlackBerry Development Advisor
jdolce
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: AS3 / AIR - BB10 Problem: TextInput, Skinning and Format

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);
	}
}

 

Please use plain text.
Developer
KermEd
Posts: 169
Registered: ‎05-18-2009
My Device: NA
My Carrier: NA

Re: AS3 / AIR - BB10 Problem: TextInput, Skinning and Format

Thanks!

 

For now, I've "unskinned" those elements.  Once it gets patched, I'll re-investigate. 

 

Ed

Please use plain text.