04-04-2007, 08:43 AM
Join Date: Apr 2007
Post Thanks: 0
Thanked 0 Times in 0 Posts
| | ObjectChoiceField + FieldChangeListener = Headache!
Please Login to Remove!
I'm trying to setup an ObjectChoiceField with a FieldChangeListener which sounds simple enough but I'm running into some weird problems. As of now there are 4 choices but only 3 are being picked up by the fieldChangeListener when they are selected (the "Default" is being ignored). here's the code:
String  services = ConferenceSettings.getAvailableServices();
int numServices = services.length;
String  choices = new String[numServices + 2];
for(i = 0; i < numServices; i++)
choices[i] = services[i];
choices[i++] = "Custom";
choices[i] = "Default (" + ConferenceSettings.getDefaultServiceString() + ")";
serviceChoice = new ObjectChoiceField("Service: ", choices);
settingChangeListener = new SettingChangeListener();
I've tried hardcoding in the indexes of "custom and "default" but that doesn't work. What's even more weird is I really want to use ConferenceSettings.getCustomServiceIndex() and ConferenceSettings.getDefaultServiceIndex() as the indexes which are services.length and services.length + 1 respectively. When I do this the "custom" choice is the one that doesn't work! I can even switch the values of the variables the functions are returning and "custom" still is the one that doesn't fire a changed event.
Any suggestions would be greatly appreciated, my head kinda hurts!