Jennifer Hardy <[EMAIL PROTECTED]> wrote:
> I have an application where the user selects a number from a list
> that is part of drop down box. I would then like to read in that
> number and store it as a variable to be used throughout the
> application. So each time, the user could select a different
> number, which I would need to use in the application. Is there a
> direct way to read the value from the list that anyone knows about?
LstGetSelection() returns the index of the selected item in the list,
and LstGetSelectionText() returns the text value of the specified list
item.
I might define the list like this (I use PilRC; getting this into
Constructor should be pretty straightforward):
LIST "1" "2" "5" "10" "20" "50" "100" "200" ID LIDgain
AT (90 20 40 AUTO) VISIBLEITEMS 8
and in my code you might see
int getgain(ListPtr list)
{
int index;
char *text;
int gain;
index = LstGetSelection(list);
if (index < 0) // no item selected
gain = -1;
else
{
text = LstGetSelectionText(list, index);
gain = StrAToI(text);
}
return gain;
}
--
Roger Chaplin
<[EMAIL PROTECTED]>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/