Tony Janke wrote:

I am trying to create a dynamic list and am going off of the example show in the 
"Palm OS Programming Bible".  Below is my code (essentially the example in the 
book) but I get the following errors:

(1) passing arg 2 of `LstSetDrawFunction' from incompatible pointer type


You should be doing something like this...
LstSetDrawFunction(listP, (ListDrawDataFuncPtr) DrawLoadFileList);

(2) `ListElements' undeclared (first use in this function)


You declared "ListElements" inside another function, and it will be available ONLY to that function. You should create that list as a global variable, so that it is available to the draw function.


Note: For now, I have a static list.  I wanted to do one step at a time.

---------------------------------------------------------------------------------------------------------------------------------
static Boolean LoadFileNameFormHandleEvent(EventType* pEvent)
{
FormType* pForm;
ListType* listP = GetObjectPtr(1005);
UInt8 numChoices = 0;
UInt16 counter;
char ListElements[5][10] = {
{ "350Z_04" },
{ "Titan_04" },
{ "RF_Hummer" },
{ "Audi_99" },
{ "BMW_M5_04"}
};
OemiDBRecordType *CarPtr;
OemiDBRecordType Car;
MemHandle recordH;

WriteNumberToField(DmNumRecords(OemDB), 1003); // shows the number of records in the database


        LstSetDrawFunction(listP, DrawLoadFileList);   
<-------------------------(1)
        numChoices = sizeof(ListElements)/sizeof(ListElements[0]);
        LstSetChoices(listP, NULL, numChoices);
        FrmDrawForm(FrmGetActiveForm());
}

static void DrawLoadFileList(UInt16 itemNum, RectangleType *bounds, Char 
**itemsText)
{
        WinDrawChars(       ListElements[itemNum],      
<---------------------(2)
                         StrLen(ListElements[itemNum]),
                         bounds->topLeft.x,
                         bounds->topLeft.y);
}

---------------------------------------------------------------------------------------------------------------------------------

thanks in advance!

~Tony








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

Reply via email to