I have this in my .rcp file.

LABEL "Date:" AUTOID AT (10 20)
POPUPTRIGGER "DMY" ID PrefsDatePopup AT (PREVRIGHT+2 PREVTOP AUTO AUTO) LEFTANCHOR
POPUPLIST ID PrefsDatePopup PrefsDateList
LIST "DMY" "YMD" "MDY" "YDM" "DYM" "MYD" ID PrefsDateList AT (PREVLEFT PREVTOP AUTO 68) VISIBLEITEMS 6 NONUSABLE


At runtime, I can select one of the 6 date formats. No problem. My handler contains this snippet of code that looks for the event, gets the item selected and importantly, which one of the many popup triggers I have on my form. As you see, I'm only interested in the date list here:

                case popSelectEvent:
                SelectedListItem = EventP->data.popSelect.selection;
                    switch(EventP->data.popSelect.listID)
                    {
                            case PrefsDateList:
                                _Prefs.SelectedDateType = SelectedListItem;

Dbg("PrefsHandleEvent->SelectedDateType","%hd",_Prefs.SelectedDateType);
                            break;

This works fine. I respond to the event and save the selected item back into the preferences structure. When I relaunch my app, I get the saved list item and use that in this snippet of code:


Dbg("Form1DoMenu->SelectedDateType","%hd",_Prefs.SelectedDateType);
DateList = (ListType *)FrmGetObjectPtr(Form, FrmGetObjectIndex(Form, PrefsDateList));
if(DateList)
{
LstSetSelection(DateList, _Prefs.SelectedDateType);
}


This works 99% fine. When I tap on the popup the correct item is selected and highlighted but the display shows the first item in the list. That is, given my selections:

"DMY" "YMD" "MDY" "YDM" "DYM" "MYD"

my saved selection might be "YDM" (selected item 3) but the form displays the first (item 0) "DMY". Naturally I get the selected item from my saved preferences and if it is set to "YDM" I'd like the form to display "YDM". How do I do this?

I tried the LstSetTopItem, LstDrawList and LstScrollList functions but those don't make any change to the screen. When I select an item from the list manually what I select gets displayed correctly but I want to achieve this from program control when the form is displayed.

Any ideas?

TIA

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

Reply via email to