BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-09-2010, 04:36 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to load the second list in spinbox if I select/focus an item of the first list?

Please Login to Remove!

How to load the second list in spinbox if I select/focus an item of the first list?

public class SpinTest extends BaseScreen implements FocusChangeListener {

final String[] stateList={"New York","Washington"};
final String[] NYcities={"Manhattan","Queens","Brooklyn","Bronx"} ;
final String[] WashCities={"Seattle","Redmond","Kent","Bellevue"} ;

public SpinTest(){
SpinBoxFieldManager spinBoxMgr = new SpinBoxFieldManager();

SpinBoxField spinBoxStates = new TextSpinBoxField(stateList);
spinBoxStates.setFocusListener(this);

SpinBoxField spinBoxCities= new TextSpinBoxField(NYcities);

spinBoxMgr.add(spinBoxStates );
spinBoxMgr.add(spinBoxCities);

add(spinBoxMgr);
}

public void focusChanged(Field field, int context) {
if (spinBoxStates== field) {
String sel = (String) spinBoxStates.get(spinBoxStates.getSelectedIndex() );
if (sel.equals("New York")) {

//I have to load all the cities of New York in second wheel if I select "New York" in first wheel
}
else if(sel.equals("Washington")) {
//I have to load all the cities of Washington in second wheel if I select "Washington" in first wheel
}

}
Offline  
Old 08-10-2010, 08:42 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Somebody pls help me.
Offline  
Old 08-10-2010, 02:29 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I try with following code, it throws "IllegalArgumentException".
Please somebody help me. It's urgent.

Code:
public void focusChanged(Field field, int context) {
if (spinBoxStates== field) {
String sel = (String) spinBoxStates.get(spinBoxStates.getSelectedIndex() );
if (sel.equals("New York")) {

//I have to load all the cities of New York in second wheel if I select "New York" in first wheel

TextSpinBoxField desc = new TextSpinBoxField(NYcities);
spinBoxMgr.replace(spinBoxCities,desc);
//spinBoxCities =  new TextSpinBoxField(NYcities);
//How to refresh the manager

}
else if(sel.equals("Washington")) {

//I have to load all the cities of Washington in second wheel if I select "Washington" in first wheel

}

}
Offline  
Old 08-12-2010, 12:02 PM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solved !!!

Code:
public void focusChanged(Field field, int context) {
if (spinBoxStates== field) {
String sel = (String) spinBoxStates.get(spinBoxStates.getSelectedIndex() );
if (sel.equals("New York")) {
spinBoxCities.setChoices(NYcities);
}
else if(sel.equals("Washington")) {
spinBoxCities.setChoices(WashCities);
}

}

Last edited by romah : 08-12-2010 at 12:04 PM.
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

DEKOLINK Microwave RF 300QB85000 Power Amplifier
$19.99
 DEKOLINK Microwave RF 300QB85000 Power Amplifier pictureFANUC POWER SUPPLY MODULE A06B-6087-H130 PSM-30 Used with 14 DAY WARRANTY
$1300.0
FANUC POWER SUPPLY MODULE A06B-6087-H130 PSM-30 Used with 14 DAY WARRANTY pictureHoneywell R7847 B 1031 Dynamic Ampli-Check Rectification Flame Amplifier
$125.0
Honeywell R7847 B 1031 Dynamic Ampli-Check Rectification Flame Amplifier pictureHoneywell R7847 C 1005 Dynamic Self-Check Rectification Flame Amplifier
$175.0
Honeywell R7847 C 1005 Dynamic Self-Check Rectification Flame Amplifier pictureHoneywell R4847 B 1082 Rectification Flame Amplifier 2 or 3 Seconds
$125.0
Honeywell R4847 B 1082 Rectification Flame Amplifier 2 or 3 Seconds picture






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