I have a form that has a popup listbox on it. I wrote the following
function that, given an input string and a ListType *, should select the
item in the popup list that matches the input string. (Seemed Simple).
However when the following function executes. The PopUp Listbox is
displayed with it's label rather than the selected item. I believe the
problem must lie in my use of LstSetSelection, I have tried a myriad of
other Lst functions, but none have given me the desired result.
Has anyone else run into and/or conquered this problem?
Mark Douglas
Boolean ListSetSelectedItemFromValue(ListType *listP, Char * pszValue) {
UInt16 usNumItems = 0;
UInt16 i;
Char * pszListItem = NULL;
usNumItems = LstGetNumberOfItems(listP);
for(i = 0; i < usNumItems; i++) {
pszListItem = LstGetSelectionText (listP, i);
if(pszListItem != NULL) {
if(StrCaselessCompare(pszListItem, pszValue) == 0){
LstSetSelection(listP, i);
return true;
}
}
}
return false;
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/