The pointer is where your problem lies.  How did you save the name in your structure?  
Where do you think that pointer is pointing to after your try to read that record back?

K

-----Original Message-----
From: christy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 2:29 PM
To: Palm Developer Forum
Subject: "unallocated chunk of memory" error when call "WinDrawChars"


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/


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

The information in this transmittal and any attachments is privileged and confidential 
and is intended only for the recipient(s) listed above. You are hereby notified that 
any unauthorized distribution or copying of this transmittal or its attachments is 
prohibited. If you have received this transmittal in error, please notify Invivodata 
immediately at (831) 438-9550.

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


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

Reply via email to