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


Mitsubishi RX41C4-TS PLC Processor Module MELSEC IQ R New picture

Mitsubishi RX41C4-TS PLC Processor Module MELSEC IQ R New

$239.00



Mitsubishi FX3UC-64MT/D PLC CPU Units Sequencer MELSEC-F DC24V Japan used picture

Mitsubishi FX3UC-64MT/D PLC CPU Units Sequencer MELSEC-F DC24V Japan used

$110.00



NEW Factory Sealed AB 1747-L541 SLC 500 CPU Controller Processor Module 1747L541 picture

NEW Factory Sealed AB 1747-L541 SLC 500 CPU Controller Processor Module 1747L541

$308.57



2080-L50E-24QWB Micro850 24 I/O EtherNet/IP Controller Allen-Bradley.NEW OPE BOX picture

2080-L50E-24QWB Micro850 24 I/O EtherNet/IP Controller Allen-Bradley.NEW OPE BOX

$294.50



New Factory Sealed AB 1747-L541 SER C SLC 500 CPU Processor Unit Module 1747L541 picture

New Factory Sealed AB 1747-L541 SER C SLC 500 CPU Processor Unit Module 1747L541

$318.73



New Siemens 6ES7214-1AG40-0XB0 6ES72141AG400XB0 SIMATIC S7-1200 CPU 1214C picture

New Siemens 6ES7214-1AG40-0XB0 6ES72141AG400XB0 SIMATIC S7-1200 CPU 1214C

$247.28







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