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

Java Development

Reply
New Developer
HarryDev
Posts: 5
Registered: ‎02-22-2009
My Device: Not Specified

How do I change the style of a field?

Hello All,

 

How do I change the style (e.g. LabelField.FIELD_LEFT) of a LabelField after it has been instantiated?  I didn't see a setStyle or setFieldStyle for any of the Field subclasses.  Did I miss something?

 

Thanks,

Harry

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How do I change the style of a field?

No, you did not miss anything.

 

there is no setStyle() neither setFieldStyle() methods available for LabelField nor for Field classes.

 

to change style of LabelField instance remove it from the Manager instance, compose a new one and add to the Manager instance.

 

assign null to the variable that holds the reference to removed LabelField instance. It will help to recycle the unused memory in your application.

Please use plain text.
New Developer
HarryDev
Posts: 5
Registered: ‎02-22-2009
My Device: Not Specified

Re: How do I change the style of a field?

Thanks for the quick response.  That's an interesting solution.  I would have forgotten to set the first one to null.

 

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How do I change the style of a field?

Set field reference to null after the field has been removed from the manager.

 

Setting field reference to null does not remove it from the screen/manager. It is just additional memory conserving measure.

 

To remove field from the screen/manager use delete() method.

 

 

Please use plain text.