BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-15-2009, 09:12 AM   #1 (permalink)
New Member
 
Join Date: Oct 2009
Model: 8330
PIN: N/A
Carrier: Sprint
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Program with multiple ListFields

Please Login to Remove!

Hello, I need to write a program that has a total of 5 listfields on individual screens that the user will navigate through, finally displaying a results page. When the user clicks on one of the listfields, it needs to store the result, clear the list, and draw a new list based on what the user selected. I've made this program for windows and windows mobile using visual c#, but I'm having extreme difficulty writing this for blackberry.

I've been able to show a list on the screen, and react to the user clicking the trackball. I've been able to delete the elements of a list, but it just shows *empty* on the screen, and I havent been able to repopulate it. I have also been unable to clear the screen entirely to draw a new list. in c#, all I would have to do is use listbox1.visible = true/false, and listbox1_SelectedIndexChanged, and I could use these to flow through the program.

I'm going crazy here. I've been searching for days to find some example code that shows how to do this, but they only show one instance of listfield. can someone write a quick sample code that will show how to do all of this?

Thanks
Offline  
Old 10-15-2009, 09:39 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

I would just create a new list field, remove the old one, and add the new one to the screen.
Offline  
Old 10-15-2009, 10:02 AM   #3 (permalink)
New Member
 
Join Date: Oct 2009
Model: 8330
PIN: N/A
Carrier: Sprint
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply, I've tried to remove the old listfield, but have been unable to do so. the most that i could do was remove individual items, ultimately leaving the listfield at *empty*, which is displayed on the screen. I can show another list, but the 1st one wouldnt clear out. is there a removal code such as listfield1.remove or visible?
Offline  
Old 10-15-2009, 11:12 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

The field is removed using the Manager.

Manager.delete() or Manager.deleteAll()

You'll need to get a reference to your manager to do this. If you are using MainScreen, then you have to ask the screen for this reference using getMainManager. If you added the list to your own manager, then you already have this reference.
Offline  
Old 10-15-2009, 02:24 PM   #5 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

I just set the list size to the new number of elements with a call to setSize(int size) or setSize(int size, int focusRow) then call invalidate() and make sure the ListFieldCallback methods access the data for the new list.
__________________
My other Blackberry is a PlayBook.
Offline  
Closed Thread


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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