I used follow code to get selected text in List.
//MainCountryList items are:
// China,England,France,Russian,American
// Main codes
Char *label;
ListPtr lstP;
lstP = (ListPtr) GetObjectPtr(MainCountryList); // MainCountryList
label = MemPtrNew(32);
if (label)
{
StrCopy(label, LstGetSelectionText(lstP, LstGetSelection(lstP)));
label = LstGetSelectionText(lstP, 2);
// ControlValueAlert message's format is " ^1 is ^2"
FrmCustomAlert(ControlValueAlert,"ListCountry", label, NULL);
MemPtrFree(label);
}
// GetObjectPtr define
static void * GetObjectPtr(UInt16 objectID)
{
FormPtr frmP;
frmP = FrmGetActiveForm();
return FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, objectID));
}
// End main codes
The app will open the alert window when I selected any item,
and the message is "ListCountry is xxx",but the "xxx" isn't any item's text
in MainCountryList,it's a random string.
I think that is a point error! but I can't find where is error?
Who can help me? Thanks!
Sean Yang
22, Feb, 2003
I
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/