> What I want to do is retreive the text in a list.
>
>
> void MyFunction()
> {
>     Word HitButton;
>     Word indx;
>     ListPtr list;
>     FormPtr frm;
>     char* tmp ;
>
>      frm = FrmGetActiveForm();
>
>      list =
> (ListPtr)FrmGetObjectPtr(frm,FrmGetObjectIndex(frm,ViewLogsDBListList));
>      indx = LstGetSelection (list);
>      tmp = LstGetSelectionText (list, indx);    // return pointer to text
in
> list
>      HitButton = FrmCustomAlert(LogDeleteAlert, tmp, NULL , NULL);
> }
>
> I get a "app read from low memory" error when it gets to the
> "LstGetSelectionText" line.  "List" is a valid ListPtr and "indx" = the
> index of the item in the list.

1) Make sure you're not getting a "-1 == noListSelection" from
LstGetSelection, which would happen if nothing is selected in the list.

2) LstGetSelectionText only works if you've got real text entries in the
list.  If you're using a custom draw function, then there is no backing list
of strings from which to grab.

> Another questions is why in all the examples I never see FrmGetObjectPtr,
or
> other functions that return void pointers, needing to be typecasted to the
> type of the pointer that is being set?  But if I do that I get a "cannot
> convert void* to [insert type here]*" error when I compile?

If you're in C++, you'll get this message.  In C, "void *" silently converts
to any other pointer type, so you get no warning.



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

Reply via email to