>David, I think you're going to need some type casts for this to work on a
>C++ compiler. (I could be wrong -- I normally use C for my Palm apps.)
Right you are. (I also normally use C.)
Here's the slightly uglier but more correct code, along with the
FrmDrawForm that I had omitted from frmOpenEvent. This time I even tested
it before posting :-)
case frmOpenEvent: {
FormType *frm;
ListType *theList;
ControlType *theTrigger;
Int16 defaultValue;
// initialize the popup's selection, and set the popup trigger's text
frm = FrmGetActiveForm();
theList = (ListType *) FrmGetObjectPtr(frm, FrmGetObjectIndex(frm,
MainVolumeList));
theTrigger = (ControlType *) FrmGetObjectPtr(frm,
FrmGetObjectIndex(frm, MainVolumePopTrigger));
defaultValue = 0; // or whatever you want
LstSetSelection(theList, defaultValue);
CtlSetLabel(theTrigger, LstGetSelectionText(theList, defaultValue));
FrmDrawForm(frm);
handled=true;
}
You now have a functioning popup. All that remains is to read its value at
the right time, like this:
frm = FrmGetActiveForm();
theList = (ListType *) FrmGetObjectPtr(frm, FrmGetObjectIndex(frm,
MainVolumeList));
theSetting = LstGetSelection(theList);
Or if you want to react as soon as a selection is chosen from the popup,
add a handler for the popSelectEvent:
case popSelectEvent:
if (eventP->data.popSelect.controlID == MainVolumePopTrigger)
theSetting = eventP->data.popSelect.selection;
-David Fedor
Palm, Inc.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/