Hello all,

I could not able to view records in a table. I am pasting the code that i
have written.
When i debug i could able to see the data getting populated in the elements
of recApptsDBPtr.


Int16     rowsInTable,i,x=0;
     TablePtr   table=NULL;
     ApptsPtr   recApptsDBPtr;

for(x=0,i=0;i<numRecords;i++)
{
 recHandle = DmGetRecord(ApptsDB,(unsigned short)i);
 recApptsDBPtr = MemHandleLock(recHandle);
 if(StrCompare(TempDate,recApptsDBPtr->ApptDate)==0)
 {

  TblSetRowUsable(table,i,true);
  TblSetItemStyle (table, i, 0,labelTableItem);
  TblSetItemPtr(table, i, 0,recApptsDBPtr->ApptTime);

  TblSetItemStyle (table, i, 1,labelTableItem);
  TblSetItemPtr(table, i, 1,recApptsDBPtr->DurationInMin);

  TblSetItemStyle (table, i, 2,labelTableItem);
  TblSetItemPtr(table, i, 2,recApptsDBPtr->LocationCode);
  TblSetItemStyle (table, i, 3,labelTableItem);
  TblSetItemPtr(table, i, 3,recApptsDBPtr->PatientFName);

  TblSetRowUsable(table,i,true);

 }

 DmReleaseRecord(ApptsDB,(unsigned short)i,false);
 MemHandleUnlock(recHandle);

 recNo = i;
 TblSetCustomDrawProcedure (table, 0, MainViewDrawRecord);
 TblSetCustomDrawProcedure (table, 1, MainViewDrawRecord);
 TblSetCustomDrawProcedure (table, 2, MainViewDrawRecord);
 TblSetCustomDrawProcedure (table, 3, MainViewDrawRecord);

 }

for(i=x;i<rowsInTable;i++)
{
  TblSetRowUsable(table,i,false);
}
TblDrawTable(table);
for (i=0; i<4; ++i)
  TblSetColumnUsable(table,i,true);
 TblDrawTable(table);

//Callback function

void MainViewDrawRecord(MemPtr tableP, short row, short column,RectanglePtr
bounds)
{
 MemHandle  recHandle;
 ApptsPtr recText;
 Int16  textLen, width,recNm=0;
 Int16  recordNum = 0;
 ApptsPtr recApptsDBPtr=NULL;

 if (column == 0)
 {
   recHandle = DmGetRecord(ApptsDB, recNo);
   recText = MemHandleLock(recHandle);
   width = bounds->extent.x - 2;
   textLen = StrLen(recApptsDBPtr->ApptTime);
   WinDrawChars(recApptsDBPtr->ApptTime, textLen, bounds->topLeft.x,
bounds->topLeft.y);
   MemHandleUnlock(recHandle);
   DmReleaseRecord(ApptsDB, recNo, false);
   recNo = 0;
 }
 if (column == 1)
 {
   recHandle = DmGetRecord(ApptsDB, recNo);
   recText = MemHandleLock(recHandle);
   width = bounds->extent.x - 2;
   textLen = StrLen(recApptsDBPtr->DurationInMin);
   WinDrawChars(recApptsDBPtr->DurationInMin, textLen, bounds->topLeft.x,
bounds->topLeft.y);
   MemHandleUnlock(recHandle);
   DmReleaseRecord(ApptsDB, recNo, false);
   recNo = 0;
 }
 if (column == 2)
 {
   recHandle = DmGetRecord(ApptsDB, recNo);
   recText = MemHandleLock(recHandle);
   width = bounds->extent.x - 2;
   textLen = StrLen(recApptsDBPtr->LocationCode);
   WinDrawChars(recApptsDBPtr->LocationCode, textLen, bounds->topLeft.x,
bounds->topLeft.y);
   MemHandleUnlock(recHandle);
   DmReleaseRecord(ApptsDB, recNo, false);
   recNo = 0;
 }
 if (column == 3)
 {
   recHandle = DmGetRecord(ApptsDB, recNo);
   recText = MemHandleLock(recHandle);
   width = bounds->extent.x - 2;
   textLen = StrLen(recApptsDBPtr->PatientFName);
   WinDrawChars(recApptsDBPtr->PatientFName, textLen, bounds->topLeft.x,
bounds->topLeft.y);
   MemHandleUnlock(recHandle);
   DmReleaseRecord(ApptsDB, recNo, false);
   recNo = 0;
 }
}

Can anyone helpme...
Thank you in advance,

Murali



-- 
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