I have an app that has a table used for data entry.  On OS 3.0 devices it
works fine, but on the newer OS I have found a bit of a problem.  I let the
user tap on a row to select the entry field, and then they can use buttons
to edit the contents.  I also have a button called "Next" that will simply
select the next row on the list (each row has two lables and one field which
is edited.  I was setting the table data members of currentRow and
currentColumn directly, which started to give me errors.  With that fixed,
and by using TblSelectItem, I can highlight the row when the user taps on
it.  But the "Next" button does not highlight the row, although everything
else works just fine.  The highlighting is required to indicate to the user
which data point they are editing.  I am not using normal editable text
fields, but instead use a custom draw item where the contents of an array
are shown and edited indirectly with the use of a set of input buttons.

here is my "Next" button code:

-------------------------
// Part of my form event handler loop where cid is the control ID
// in event->data.ctlEnter.controlID
if(cid == NextFldBtn)
{
  TablePtr table = GetObjectFromActiveForm(tbl->m_TableID);
  Int16 row;
  Int16 column;
  Int16 numRows = TblGetNumberOfRows(table);
  Int16 absoluteRow;

  TblGetSelection(table,&row,&column);
  tbl->m_CurrentRow++;

  if(tbl->m_CurrentRow >= numRows || tbl->m_CurrentRow >= tbl->m_NumItems)
  {
    // This is for scrolling the table so that the selected row is in view
    if(tbl->m_CurrentRow + tbl->m_TopVisibleRow >= tbl->m_NumItems)
    {
      // We need to scroll back to the top
      DataEntryScrollRows(&doc.m_PTFData,-doc.m_PTFData.m_NumItems);
      tbl->m_CurrentRow = 0;
    }
    else
    {
      absoluteRow = tbl->m_CurrentRow + tbl->m_TopVisibleRow;
      DataEntryScrollRows(tbl,numRows);
      tbl->m_CurrentRow = absoluteRow - tbl->m_TopVisibleRow;
    }
  }
  // Set the table selection values with indirectly (Req for OS 4.x)
  TblGlueSetSelection(table,tbl->m_CurrentRow,1);
  TblSelectItem(table,tbl->m_CurrentRow,1); //<-- this is not highlighting
WHY
}
-------------------------

Why won't this highlight the newly set currentRow (actually just col 1 of
currentRow)?

Paul Gibson


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

Reply via email to