AshMcConnell
24-05-2010 08:59:53
Hi Folks,
I am trying to do a form in which I take the current values of a number of widgets when I press a "submit" button.
I have found that when I click the "submit" button the combobox's selected index becomes unassigned (-1). Just before pressing the submit button it has a "proper" selectedIndex. Also if I set the selected item using the mouse, the selectedIndex does remain correct when I press my submit button.
This is how I set the selected index in code: -
What am I doing wrong?
Thanks for your help!
All the best,
Ash
I am trying to do a form in which I take the current values of a number of widgets when I press a "submit" button.
if(wid->getTypeName() == "ComboBox"){
ComboBox *cb = cmb(widgets[i]);
Logger::LOGD("Selected Index %d , Item Count %d", cb->getIndexSelected(), cb->getItemCount());
if (cb->getIndexSelected() < cb->getItemCount()){
esm->dataList.push_back(cb->getItemNameAt(cb->getIndexSelected()));
esm->dataList.push_back(StringUtils::to_string(*cb->getItemDataAt<int>(cb->getIndexSelected())));
}else{
esm->dataList.push_back("");
esm->dataList.push_back("");
}
}
I have found that when I click the "submit" button the combobox's selected index becomes unassigned (-1). Just before pressing the submit button it has a "proper" selectedIndex. Also if I set the selected item using the mouse, the selectedIndex does remain correct when I press my submit button.
This is how I set the selected index in code: -
tracksCmb->setIndexSelected(tracksCmb->getItemCount() -1);
What am I doing wrong?
Thanks for your help!
All the best,
Ash