I'm kinda new to Palm programming and have been stuck on this bug for a long
time. Any leads would be much appreciated.

I have a four column table, and I want all columns except the first (left)
one to be editable, so I made the left column a non-editable customTableItem
and the other three textTableItems with a load procedure. It works fine,
except somehow the data for the first column becomes garbage characters
instead of text when I use any of the three editable columns. (Specifically,
when I enter, then exit, one of those cells.) I've been stuck on this for a
long time. Does anyone know what could do this? The table initialization and
load procedure are below.

// Draw exercise & set info in the WSTable
static void drawWorkoutSheetTable( void )
{
 FormPtr  form;
 TablePtr table;
 Int   column;
 Int   count;

 form = FrmGetActiveForm();

 // Get the table pointer
 table = getObject( form, WorkoutSheetTableTable );

 // First column is always usable & takes a custom draw procedure
 TblSetCustomDrawProcedure( table, 0, drawWSTNameCell );
 TblSetColumnUsable( table, 0, true );

 // The remaining 3 columns use the custom load procedure
 for( column = 1; column < WS_TABLE_NUM_COLUMNS; column++ )
 {
  TblSetLoadDataProcedure( table, column, loadWSTSetCell );
  TblSetColumnUsable( table, column, true );
 }

 // For all rows: Initialize the table styles
 for( count = 0; count < WS_TABLE_NUM_ROWS; count++ )
 {
  // If there is data for the row, make it usable & set cell styles
  if( tableRowIndex[count] != 0xffff )
  {
   TblSetRowUsable( table, count, true );
   TblSetItemStyle( table, count, 0, customTableItem ); // first column is
custom item

   // Set the non-left cell styles to textTableItem
   for( column = 1; column < WS_TABLE_NUM_COLUMNS; column++ )
   {
    TblSetItemStyle( table, count, column, textTableItem );
   }
  }
  else
  // Hide any unused rows
   TblSetRowUsable( table, count, false );
 }
 TblDrawTable( table );
 return;
}

static Err loadWSTSetCell( VoidPtr table, Word row, Word column,
  Boolean editable, VoidHand * dataH, WordPtr dataOffset,
  WordPtr dataSize, FieldPtr fld )
{
 Int  record;
 Int  set;

 record = tableRowIndex[row];
 set = tableColumnIndex[column];

 *dataH = DmQueryRecord( reflexDB, record );
 *dataOffset = DB_NUM1_START_OF1 + ( set - 1 ) * DB_SET_SIZE;
 *dataSize = MemHandleSize( *dataH );

 return (0);
}




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