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


Fluke Networks Versiv Modular Mainframe AS IS picture

Fluke Networks Versiv Modular Mainframe AS IS

$900.00



Chroma 6312 DC Electronic Load Mainframe  picture

Chroma 6312 DC Electronic Load Mainframe

$239.96



Computer Conversions Corp. Main Frame Board RTSS-4 picture

Computer Conversions Corp. Main Frame Board RTSS-4

$351.00



Integrated Circuit IC Tester LCD Digital Display Multi-functional Integrated picture

Integrated Circuit IC Tester LCD Digital Display Multi-functional Integrated

$59.67



Used National Instruments SCXI-1000 Mainframe 1200 1120 1160(2) 181445D-01 U2 picture

Used National Instruments SCXI-1000 Mainframe 1200 1120 1160(2) 181445D-01 U2

$299.95



Nordson 296025C Main Frame Board picture

Nordson 296025C Main Frame Board

$201.24







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