> Error : cannot convert
> 'void (*)(unsigned short, struct RectangleType *, char **)' to
> 'void (*)(short, struct RectangleType *, char **)'
> SuperList3.c line 9078 LstSetDrawFunction( plst, ListDrawFunc );
>
> Here are my functions:
>
> // My drawing callback function
> static void ListDrawFunc (UInt itemNum, RectanglePtr bounds, CharPtr
*data)
> {
> CharPtr cpText = NULL;
>
> cpText = gArrayOfLists[itemNum]; // an item out of a global array of
> strings.
> if (cpText)
> {
> // Draw it
> WinDrawChars (cpText, StrLen (cpText), bounds->topLeft.x,
> bounds->topLeft.y);
> }
> }
>
> In the event handler for my form
> ...
> case frmOpenEvent:
> {
> // I initialize the array of strings, gArrayOfLists[iNumLists],
> and get a list pointer, plst.
>
> // Set the drawback for the list.
> LstSetDrawFunction( plst, ListDrawFunc ); <- this line is what generates
> the error.
>
> // Set the list.
> LstSetListChoices (plst, NULL, iNumLists);
> }
>
> Note the error message refers to "RectangleType" but the callback function
> and its header declare a "RectanglePtr".
RectanglePtr is just a typedef of RectangleType *.
But that is not what it is objecting to. The compiler does not like your
recast of the first parameter from Int to UInt. It cannot generate an
automatic cast, because it is a callback function.
change your declaration to:
static void ListDrawFunc (Int itemNum, RectanglePtr bounds, CharPtr *data)
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/