Hi,
I am just getting started with the palm OS and am having some trouble
dynamically creating a list control that is connected to a popup trigger.
I used constructor to add a popup trigger to a form and I then dynamically
create a list that I connect to the popup trigger. I am getting the error
message "... just read directly from an unallocated chunk of memory". See
below for the code I am using.
Thanks,
Chris
-------------------------------------------------------
FormPtr m_pForm;
VoidHand m_hStrings;
Word eCredentialID = 101;
void CContactForm::OnOpenForm()
{
ListPtr trigger =
(ListPtr)GetObjectPtr(ContactIdentificationCredentialPopTrigger);
Word visibleItems = 3;
Err ret = LstNewList(&m_pForm, eCredentialID,
trigger->bounds.topLeft.x,
trigger->bounds.topLeft.y,
trigger->bounds.extent.x,
trigger->bounds.extent.y,
stdFont, visibleItems,
ContactIdentificationCredentialPopTrigger);
ListPtr list = (ListPtr)GetObjectPtr(eCredentialID);
CtlSetUsable((ControlPtr)list, false);
CharPtr pStrings = "PA\0MD\0RNP\0ME\0RN\0";
Word nStrCnt = 5;
m_hStrings = SysFormPointerArrayToStrings(pStrings, nStrCnt);
char **p = (char **)MemHandleLock(m_hStrings);
LstSetListChoices(list, p, nStrCnt);
}
void CContactForm::OnCloseForm()
{
ListPtr list = (ListPtr)GetObjectPtr(eCredentialID);
LstSetListChoices(list, NULL, 0);
MemHandleUnlock(m_hStrings);
MemHandleFree(m_hStrings);
m_hStrings = NULL;
}