I am drawing a list from the database. My app stops
with "unallocated chunk of memory" error on the
following "WinDrawChars" statement:

static void MainFormListDrawItem(Int16 itemNum,
RectangleType *bounds, Char **unused) {
        
 MemHandle recHandle;
 FDBRecordType *recF;
 
 /******* itemnum is always 0 here. 
 Is this where the problem is? ***********/     
 recHandle = DmQueryRecord(gF, itemNum);
 
 recF = MemHandleLock(recHandle);   

 /****** this line doesn't work. ********/
 WinDrawChars(recF->fname,StrLen(recF->fname),
bounds->topLeft.x, bounds->topLeft.y);
                
 MemHandleUnlock(recHandle);
}


Here is the Stucture for the database record:

typedef struct {
 UInt16 fid;
 char  *fname;
}FDBRecordType;

Here is my init function (this function works)

static void MainFormInit(FormPtr /*frmP*/){

 FormPtr frm;
 ListPtr lst;
 UInt16 numRecords;
        
 /* get a pointer to the main form */
 frm = FrmGetActiveForm();
        
 /* get the number of records in the database */
 /* it retuns me 100 recs */
 numRecords = DmNumRecords(gF);  
  
 if (numRecords) {
  /* get a pointer to the list object */
  lst = FrmGetObjectPtr(frm,
FrmGetObjectIndex(frm,MainLstFList));
  
  /* set the number of list choices */
  LstSetListChoices(lst, NULL, numRecords);
                
  /* set the callback function to draw the list */
  LstSetDrawFunction(lst, MainFormListDrawItem);
 }
}

Could anymore give me some pointers. Thanks.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to