You won't get the popSelect event until *after* the user has picked an item from a popped-up list.

There's really no need to handle all this manually, in your case. You can make it all automatic by setting the list ID field of the pop trigger resource (and then make sure you are not handling the ctlSelect event for the trigger). The system will handle it (when you call FrmHandleEvent()), pop up the list, manage the UI, put away the list after the user selects something (or doesn't), and then send you a popSelect event telling you what the user chose.

If you really need to modify the list manually (the contents change often, etc.), then you should handle the ctlSelect event for the pop trigger: that means the user tapped on the pop trigger, and then you can do whatever you need to (adjust the list, show it, move it, etc.).

Hope this helps,

Dave Johnson

On Sep 2, 2004, at 7:18 AM, Jennifer Fell wrote:

Hi,

I am having problem with displaying a popup list. (1) shows the declaration
part. (2) & (3) show the codes for handling the event. However, I am not
getting the popSelectEvent, I am only getting some penUp/Down and
ctlSelectEvent evens. Any idea where I am making the mistake?


Thanks,
Jenni

(1)

    POPUPTRIGGER "" ID MyTrigger AT (4 42 152 10)
    LIST ID MyList AT (PREVLEFT PREVTOP AUTO AUTO)
        VISIBLEITEMS 3
    POPUPLIST MyTrigger MyList

(2)

    switch (eventP->eType) {

        case popSelectEvent:

            if (eventP->data.popSelect.listID == MyList) {
                DisplayPopUpList (eventP->data.popSelect.selection);
            }
            break;
    }

(3)

static void DisplayPopUpList (UInt16 selection)
{
    ControlType     *trigP;
    ListType           *listP;
    FormType        *frmP;

frmP = FrmGetFormPtr(MainForm);
trigP = (ControlType*)FrmGetObjectPtr (frmP, FrmGetObjectIndex (frmP,
MyTrigger));
listP = (ListType*)FrmGetObjectPtr (frmP, FrmGetObjectIndex (frmP,
MyList));
LstSetSelection (listP, selection);
LstDrawList (listP);
CtlSetLabel (trigP, LstGetSelectionText(listP, selection));
FrmShowObject (frmP, FrmGetObjectIndex (frmP, MyList));
}


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/




--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to