Robert Baruch wrote:
Hi all,
Can someone tell me what's wrong? In my program, when LstSetListChoices is hit,
the emulator dies with an array index out of bounds.
Here's the code fragment:
static void displayCallLog()
{
ListType *list;
char *duration;
char *testArray[] = {"one", "two", "three", "four", "five"};
list = FrmGetObjectPtr(
FrmGetFormPtr(GetCallLogForm),
CallLogTable);
LstSetListChoices(list, testArray, 5);
LstDrawList(list);
}
You are telling the LstHandler to use a pointer to a list array that
only exists in this one function. As soon as the list does it's initial
draw the function will return and the pointer that you gave will no
longer be valid. You could declare the list as a global variable, then
it will be persistent.
Bob.
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/