05-06-2009, 05:40 PM
|
#1 (permalink)
|
| New Member
Join Date: May 2009 Model: 8100 PIN: N/A Carrier: Verizon
Posts: 1
Post Thanks: 0 Thanked 0 Times in 0 Posts
| ChoiceGroup itemStateChanged fired multiple times bug in BB OS? Please Login to Remove! Hello,
Here is the background for the problem: I have a recursive list of hashtables(hashtable inside another hashtable) and a form with a POPUP ChoiceGroup that is initially filled with the keys from the root hashtable. When the user selects a particluar entry a different ChoiceGroup popsup with the keys of the hashtable pointed to by the earlier selection and this goes on till an empty hashtable is found. I have noticed that when the user selects and entry in the root hashtable(or any others for that matter) itemStateChanged is called thrice instead of once.
1. Has anyone encountered this problem?
2. If so, what is the solution?
I have included the relevant code below:
-----------------------------------------------------------
public void itemStateChanged(Item item) {
System.out.println("I am in the Kind References Item state changed method. Kind no is:"+myDaf.kindNo);
isDirty = true;
if (item.getClass() == ChoiceGroup.class) {
ChoiceGroup chg = (ChoiceGroup) item;
boolean[] currentSelection= new boolean[chg.size()];
if(!previousSelectionCreated){
myDaf.previousSelections=new boolean[currentSelection.length];
previousSelectionCreated=true;
}
System.out.println("No of items selected is:"+chg.getSelectedFlags(currentSelection));
if(0==chg.getSelectedFlags(currentSelection)){
//Print out the document
new Echo(this.myDaf.DAFDoc);
this.myDaf.removeChildren(parentPath);
this.myDaf.setPreviousSelection(currentSelection);
isDirty = false; System.out.println("Removed All Children of this kind ref tree");
//Print out the document
new Echo(this.myDaf.DAFDoc); return;
}
kindFormCurrentItem= this.myDaf.getChangedSelectionIndex(currentSelecti on);System.
out.println("Kind Form Current Item set to:"+kindFormCurrentItem);
this.handleChoices();
this.myDaf.setPreviousSelection(currentSelection);
//Call a new instance of this class again
if (false==((Hashtable)(this.choiceHashtable.get(chg. getString(chg.getSelectedIndex())))).isEmpty()){
System.out.println("Calling the same class with the next hashtable");
System.out.println("Kind no is:"+myDaf.kindNo);DAKindFormClass nextChoiceList=
new DAKindFormClass("Enter Choice",this.myDaf,(Hashtable) choiceHashtable.get(chg.getString(chg.getSelectedI ndex())));
nextChoiceList.clearAndSetupDAKindForm();
nextChoiceList.displayDAKindForm();
}
else{
System.out.println("This hashtable is empty. Kind no is:"+myDaf.kindNo);
this.myDaf.displayDAHeadingForm();
}
}
else
System.out.println("Error Not a kind reference choice group");
}
-------------------------------------------------------------- |
| Offline
| |