When migrating, RsrcToRcp didn't move the VISIBLEITEMS part to the RCP file, so my 
lists were not showing anything.  Glad it was simple!

K

-----Original Message-----
From: Kevin OKeefe 
Sent: Tuesday, August 12, 2003 10:27 AM
To: Palm Developer Forum
Subject: Unexpected behavior with PopupTriggers after migrating to
rcp-based resources


Hi all.

I have recently migrated my resource to use rcp files.  I have discovered that my 
popup triggers no longer work as they once did.  In fact, setting a break point in the 
handler shows that popSelect events never occur.  I'm sure I've done something silly, 
but I can't see it.

It seems that as configured I need to be owner-drawn now, whereas with the 
constructor-based resources the OS handled it for me....

I find is strange that the behavior has changed since moving to RCP-based resources...


Here's the rcp for the popup trigger:

...
    POPUPTRIGGER "HH:MM am/pm" ID SetupTimeFormatPopTrigger AT (62 32 80 12) USABLE 
LEFTANCHOR
    POPUPLIST ID SetupTimeFormatPopTrigger SetupTimeFormatList
    LIST "" ID SetupTimeFormatList AT (62 50 84 09) NONUSABLE
...


The popup trigger is initialized like this in the form's init function:

        // init time format
        pref = PrefGetPreference(prefTimeFormat);

        GetStringListFromListRes(TimeFormatsStringList, &timeListP, &numStrings);

        listP = (ListType*)GetObjectPtr(SetupTimeFormatList);
        ctlP = (ControlType*)GetObjectPtr(SetupTimeFormatPopTrigger);
        
        LstSetListChoices(listP, timeListP, numStrings);
        LstSetSelection(listP, (Int16)TimeMap[pref].listIndex);
        selectionTextP = LstGetSelectionText(listP, (Int16)TimeMap[pref].listIndex);
        CtlSetLabel(ctlP, selectionTextP);


// The TimeMap is a little data structure that maps the formats we support to the 
formats the os defines.
// All pointers and lists are ok in the debugger.

The handler looks like this:

static Boolean SetupFormHandleEvent(EventPtr eventP)
{
   Boolean              handled = false;
   FormPtr              frmP = NULL;
   MemHandle    recH = NULL;
   

        switch (eventP->eType) 
        {
        case nilEvent:
                {
                        UInt32                  time;
                        DateTimeType    dt;
                        time = TimGetSeconds();
                        TimSecondsToDateTime(time, &dt);
                        UpdateTime(&dt);
                        UpdateDate(&dt);
                }
                break;                  
                        
        case ctlSelectEvent:
                switch(eventP->data.ctlSelect.controlID)
                {
                case SetupTimeEditSelTrigger:
                        OnTimeTriggerSelect();
                        handled = true;
                        break;
                
                case SetupDateEditSelTrigger:
                        OnDateTriggerSelect();
                        handled = true;
                        break;
                }
                break;
        
        case popSelectEvent:
                switch(eventP->data.popSelect.controlID)
                {
                case SetupDateFormatPopTrigger:
                        OnDateFormatPopTrigger();
                        handled = true;
                        break;
                        
                case SetupTimeFormatPopTrigger:
                        OnTimeFormatPopTrigger();
                        handled = true;
                        break;
                        
                case SetupLanguagePopTrigger:
                        if(OnLanguagePopTrigger())
                        {
                                verShown_g = false;
                                ret = SetLanguage();
                                // This code will only execute on <4.0 OS.
                                FrmEraseForm(thisForm_g);
                                FrmDeleteForm(thisForm_g);
                                
                                // Clean up some memory used
                                FreeStringListFromRes(&langListP);
                                FreeStringListFromRes(&dateListP);
                                FreeStringListFromRes(&timeListP);
                                if(langMapP)
                                {
                                        MemPtrFree(langMapP); 
                                        langMapP = NULL;
                                }
                                
                                thisForm_g = FrmInitForm(SetupForm);
                                FrmSetActiveForm(thisForm_g);
                                FrmSetEventHandler(thisForm_g, SetupFormHandleEvent);
                                SetupFormInit(thisForm_g);
                        }
                        
                        handled = true;
                        break;
                }       
                break;  
                
        case MSG_NEDGOKEYEVENT:
                // Get values from form and save them
                done_g = true;
                handled = true;
                break;
        
        default:
                break;
                
        }
        
        return handled;
}

The popSelect event is never fired....


Thanks,
Kevin


------------------------------------------
The information in this transmittal and any attachments are confidential and intended 
only for the recipient(s) listed above. You are hereby notified that any unauthorized 
distribution or copying of this transmittal or its attachments is prohibited. If you 
have received this transmittal in error, please notify invivodata immediately at (831) 
438-9550.
------------------------------------------



-- 
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