BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-24-2009, 01:51 AM   #1
Klanjabrik
Knows Where the Search Button Is
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: simulator
Posts: 21
Default Delete LabelField in VerticalFieldManager

Please Login to Remove!

Hi guys, need your help here...

I've created LabelField inside verticalfieldmanager, the code:

PHP Code:
cox = new VerticalFieldManager(Manager.VERTICAL_SCROLL Manager.VERTICAL_SCROLLBAR);
labelLoading = new LabelField("Please wait..." ,DrawStyle.ELLIPSIS LabelField.USE_ALL_WIDTH LabelField.FOCUSABLE LabelField.HCENTER);
cox.add(labelLoading);
add(cox); 
at another public void, i try to delete the labeLoading, the code:

PHP Code:
public void setStatusOff() {
       
statusField.setText("Done");
       
delete(labelLoading);
    } 
but i always got error...
Offline  
Old 04-24-2009, 02:48 AM   #2
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

Code:
cox.delete(labelLoading);
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  
Old 04-24-2009, 10:41 AM   #3
Klanjabrik
Knows Where the Search Button Is
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: simulator
Posts: 21
Default

hi Ivanov, thx

still not working....
Offline  
Old 04-24-2009, 10:48 AM   #4
hippocamp software
Thumbs Must Hurt
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: T-Mobile
Posts: 67
Default

is it not working at all, or are you getting an exception?

you need to check the field is diplayed before deleting it:

if(labelLoading.isVisible()){
cox.delete(labelLoading);
}
Offline  
Old 04-24-2009, 11:23 AM   #5
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

Unless cox is out of scope. You could try:
Code:
public void setStatusOff() {
       statusField.setText("Done");
       labelLoading.getManager().delete(labelLoading);
    }
You may also need to ensure that you are executing on the event thread.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 04-24-2009, 02:10 PM   #6
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

My guess is that your setStatusOff() code is being called from a listener thread, not the UI thread. If that is the case, you will need to wrap your setText() in a Runnable and place it in the event queue by calling invokeLater().
Offline  
Old 04-24-2009, 05:53 PM   #7
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

Or you can synchronize on Application.getEventLock():

Code:
public void setStatusOff() {
       statusField.setText("Done");
       synchronized(Application.getEventLock()) {
           labelLoading.getManager().delete(labelLoading);
       }
    }
which is generally more efficient.

Which is what I meant.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 04-25-2009, 06:40 PM   #8
Klanjabrik
Knows Where the Search Button Is
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: simulator
Posts: 21
Default

Thx Doug, your guesses is absolutely right...

and i 've tried to use the code from hrbuckley, and it's working smoooooth...

Thx to you all...
Offline  
Old 04-25-2009, 09:10 PM   #9
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

You are most welcome.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 04-26-2009, 04:48 AM   #10
Klanjabrik
Knows Where the Search Button Is
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: simulator
Posts: 21
Default

Aother question:

How can i add field in "public void setStatusOff() {..." ?
Offline  
Old 04-26-2009, 07:35 PM   #11
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

As long as you do it on the event thread, either the synchronized portion in my example, or the run() method of the Runnable in Dougsg38p's suggestion you should be fine, adding it in the normal way.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 04-30-2009, 12:41 AM   #12
Klanjabrik
Knows Where the Search Button Is
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: simulator
Posts: 21
Default

thx for the help, guys...

it means alot to me to working on the project.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Nextiva X-835 SIP Color Deskset VoIP Phone Black New In Box picture

Nextiva X-835 SIP Color Deskset VoIP Phone Black New In Box

$44.99



Polycom Vvx 601 VoIP 16 Line Business Phone 4.3

Polycom Vvx 601 VoIP 16 Line Business Phone 4.3" HD Touchscreen PoE With Stand

$28.95



Allworx 9212 VoIP IP Phone with Stand Warranty Paetec 9212P Business Office picture

Allworx 9212 VoIP IP Phone with Stand Warranty Paetec 9212P Business Office

$17.98



Polycom VVX410 VoIP IP Phone & Stand Warranty Reset VVX 2201-46162-001 SIP Skype picture

Polycom VVX410 VoIP IP Phone & Stand Warranty Reset VVX 2201-46162-001 SIP Skype

$19.98



Polycom VVX300 VoIP IP Phone & Stand Warranty Reset VVX 2201-46135-001 SIP Skype picture

Polycom VVX300 VoIP IP Phone & Stand Warranty Reset VVX 2201-46135-001 SIP Skype

$17.98



GAI-Tronics 276-002BH Behavioral Health VoIP phone -Volume Control, Indoor, PSTN picture

GAI-Tronics 276-002BH Behavioral Health VoIP phone -Volume Control, Indoor, PSTN

$179.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.