--On 25 July 2001 10:10 +0000 manish jaggi <[EMAIL PROTECTED]> wrote:
> I am trying to add items dynamically to a list
> but there is a problem in LstSetChoices()
> the error is This Application has just Read from low Memory
>
> MemHandle HCity[10];
> char List[10][30];
> char *List1[10];
> -- allocate memory for HCity----
>
> MemHandle HRecord;
> HRecord =MemHandleNew(40);
> for(int i=counter;i< counter + 10 ;i++)
> {
> locked=1;
> int k = i - counter;
> GetCity(HCity[k],i,HRecord);
> StrCopy(List[k] ,(char*)MemHandleLock(HCity[k]));
> List1[k] = List[k];
> }
>
> problem Line:::-> LstSetListChoices ((ListType*) FrmGetObjectPtr(frmP,
> FrmGetObjectIndex(frmP, AtlasCityList)), (char**) List1, 10);
You don't need to List1[k]=List[k]; also replace List1 with List in
LstSet...
BTW, char*[] == char[][] == char** Also, unless you know that your city
names are always going to be < 30 characters, I'd use StrNCopy(). Just out
of curiosity, you do know that LstSetChoi... doesn't actually copy the
strings, right? If it still doesn't work add a few trace calls with
HostTraceOutput and use reporter. :-)
IM :-)
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/