[EMAIL PROTECTED] wrote:
> 
> Hi,
> 
> I've managed to populate a table, with two columns custom style, using a 
> custom drawing function, and working scrollbars.
> 
> The slight problem that remains is that the first time the table is drawn, 
> the first row is scrambled while all subsequent rows are drawn correctly. 
> More specifically, on the first line, the second column nearly entirely 
> overwrites the first column. On the following lines, everything is OK.
> 
> If I use the scrollbar, down and up again, the first row gets redrawn 
> correctly.
> 
> I have stepped with the integrated debugger into the code, and see that the 
> first time the first row is drawn, the "bounds" structure that is 
> automatically sent back to the custom drawing function holds a wrong value 
> for the "topLeft.x" parameter. This is just "+1" with respect to the first 
> columns X coordinate, instead of having the correct positioning for the 
> second column.
> 
> As I said, all following rows are correctly drawn, and if the entire table is 
> redrawn for some reason, ex. scrolling, everything is OK too with the first 
> row.
> 
> Does anyone have an idea what may be the reason for this strange behavior? I 
> tried to attach a screenshot, but my message got rejected because it had the 
> attachment. (Why then offer the possibility of attaching files if it is 
> rejected?...).
> 
> Thanks for any suggestions!
> 
> Anne-Marie

Hi Anne-Marie,

Does your table initialization start at row index 0?  My table
initialization usually looks something like this:

void GroupFormTableInit(FormType *form) {
   TableType *table;
   Int16 irow;

   /* Initialize table cells. */
   table = (TableType *)ctrlPtr(form, GroupFormTable);
   for (irow=0; irow<TableRows; irow++) {
      TblSetRowHeight(table, irow, 12);
      TblSetRowStaticHeight(table, irow, true);

      TblSetItemStyle(table, irow, GroupFormAbbreviationColumn,
customTableItem);
      TblSetItemStyle(table, irow, GroupFormNameColumn,
customTableItem);
      TblSetItemStyle(table, irow, GroupFormCheckColumn,
checkboxTableItem);
   }
      
   /* Make columns visible. */
   TblSetColumnUsable(table, GroupFormAbbreviationColumn, true);
   TblSetCustomDrawProcedure(table, GroupFormAbbreviationColumn,
DrawCustomGroupAbbreviation);
   TblSetColumnSpacing(table, GroupFormAbbreviationColumn, 0);

   TblSetColumnUsable(table, GroupFormNameColumn, true);
   TblSetCustomDrawProcedure(table, GroupFormNameColumn,
DrawCustomGroupName);
   TblSetColumnSpacing(table, GroupFormNameColumn, 0);

   TblSetColumnUsable(table, GroupFormCheckColumn, true);
   TblSetColumnSpacing(table, GroupFormCheckColumn, 0);
}

Lonnon Foster's 'Palm OS Programming Bible' has a lot of helpful sample
code involving tables.

Greg

To unsubscribe send an email to  [EMAIL PROTECTED]
-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to