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 Contributor
Posts: 2
Registered: ‎08-07-2011
My Device: BlackBerry Torch
My Carrier: TSTT
Accepted Solution

Add Controls dynamically

Is there a code example of how you can add Controls dynamically in

I have a ObjectChoiceField with a Listener and I need to add and remove controls dynamically based on the choice.

 

using Java Plugin Eclipse

9700

Developer
Posts: 19,621
Registered: ‎07-14-2008
My Device: Not Specified

Re: Add Controls dynamically

Welcome to the forums.

 

No need for samples, all you need to do is 'add' in the same way as you do when you add the original controls to the screen.  You can delete as well.  The one trick is that you need to be running on the Event Thread to do this, but if you perform this operation in a fieldChangeListener or menu click or focus change, then you are running on the Event Thread and the add/delete operations can be done.

 

Hope this is enough information for you. 

New Contributor
Posts: 2
Registered: ‎08-07-2011
My Device: BlackBerry Torch
My Carrier: TSTT

Re: Add Controls dynamically

thanks!!