> I have made a table with three columns and three rows. The height of each row
> is 40. The tblSelectEvent is fired only whien I click on the above 11 pixels
> of each row. How do I make the whole row selectable.

I had this *exact* same problem w/ the table in my app (AsciiChart).
What is the itemType of your table items?  If it's anything other then
textTableItem or textWithNoteTableItem, then the table object will
restrict item selection (and highlighting) to 11 pixels, the height of
the stdFont.  If you look at the code for the Table object (see
http://oasis.palm.com/devzone/knowledgebasearticle.cfm?article_id=1152),
you'll find this logic for determining the bounds of an object:

static void
TblGetItemBounds (TablePtr table, Word row, Word column, RectanglePtr r)
{
    int i;
    FontID curFont;
    TableItemPtr item;
[...]
    r->topLeft.x = table->bounds.topLeft.x;
    r->topLeft.y = table->bounds.topLeft.y;

    // Find the top bound of the item.
    for (i = table->topRow; i < row; i++)
        {
        if (table->rowAttrs[i].usable)
            r->topLeft.y += table->rowAttrs[i].height;
        }
        
    // Find the bottom bound of the item.
    for (i = 0; i < column; i++)
        {
        if (table->columnAttrs[i].usable)
            r->topLeft.x += table->columnAttrs[i].width + 
                            table->columnAttrs[i].spacing;
        }
        
    r->extent.x = table->columnAttrs[column].width;
    r->extent.y = table->rowAttrs[row].height;
    
    item = &table->items[row*table->numColumns+column];

    if ((item->itemType != textTableItem) &&
         (item->itemType != textWithNoteTableItem))
        {
        curFont = FntSetFont (tableFont);
        r->extent.y = FntLineHeight ();
        FntSetFont (curFont);
        }

}

The problem is that last "if"; if the itemType isn't text, then this
if block limits the y extent of the item to the FntLineHeight of
tableFont (=stdFont), 11 pixels.  IMO, this doesn't make sense, at
least not for customTableItem's.

My fix (not very good; I'd prefer something simplier; suggestions
anyone?) was to actually incorporate this code into my program, but
to comment out the problematic "if" statements.  To do this, I had to
track penDownEvent's in my form, and call my own TblHandleEvent()
(basically, the code in Table.c from Palm, minus the FntLineHeight()
adjustments):

static Boolean
MainFormHandleEvent(EventPtr event)
{
...
    case penDownEvent:
     /* Handle penDowns in table */
      TblGetBounds(table,&rect) ;
      if ( RctPtInRectangle(event->screenX,event->screenY,&rect) )
        handled = MyTblHandleEvent(table,event) ;
      else
        handled = false ;
      break ;

    case tblEnterEvent:
      handled = MyTblHandleEvent((TablePtr)event->data.tblEnter.pTable,event) ;
      break ;
...
  return(handled) ;
}

BTW, the table code from Palm is for the table handlers from PalmOS
1.0, but the points here still seem to apply to current PalmOS (Palm,
please correct me if I'm wrong).

Hope this helps,

John

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to