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
Regular Contributor
Posts: 64
Registered: ‎02-03-2010
My Device: Bold
My Carrier: Orange
Accepted Solution

How to update the text fields of a Dialog?

Hi, I wanted to create a Dialog with a timer - I want one of the buttons to show

OK(5)

OK(4)

OK(3)

as time goes along. Is there any way to set the labels of the buttons in a Dialog after it has been created? If not, what would be the easiest way to achieve this? I'm a newbie to BB Fields, Field Managers, etc, so would be glad for some more learned advice.

 

Thank you very much,

Dan.

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: How to update the text fields of a Dialog?

My suggestion is to make your own dialog by extending PopupScreen and adding your own ButtonField to it.

 

Retain a reference to the ButtonField and set the text using ButtonField.setLabel()

 

Now, assuming that your change of the label will be done from a worker thread or a timer, then you will need to place your setLabel() code in a Runnable, and use UiApplication.invokeLater() to invoke this runnable in the event thread. This is done because you cannot access the UI classes form outside of the event thread.

 

 

 

Regular Contributor
Posts: 64
Registered: ‎02-03-2010
My Device: Bold
My Carrier: Orange

Re: How to update the text fields of a Dialog?

Thanks for the reply, just what i was looking for.