Mark,

I use Palm Object Library and ran into the same problem. I use the default
font so some of the items are hard coded but the code below now causes the
entire row to be selected. Basically you need to check that the penDown is
after the first 11 pixels, for the default font, and if it is queue a
tblEnterEvent.


         RectangleType rectTable;
         GetBounds(rectTable);
         // see if the point is in the table
         if( RctPtInRectangle(pEvent->screenX, pEvent->screenY,
&rectTable) )
         {
                Int16 screenY = pEvent->screenY - rectTable.topLeft.y;
            // calulate which row we are in
                // only send the tblEnterEvent if after the first 11 pixels, using
standard font so
                // it's hardcoded
            if( screenY % m_wRowHeight > 11 )
            {
                Int16 row = (screenY / m_wRowHeight);
                // send a table enter event
                EventType event;
                MemSet(&event, sizeof(event), 0);
                event.screenX = pEvent->screenX;
                event.screenY = pEvent->screenY;
                event.eType = tblEnterEvent;
                event.data.tblEnter.tableID = CTable::GetObjectID();
                event.data.tblEnter.pTable = GetTablePtr();
                event.data.tblEnter.row = row;
                event.data.tblEnter.column = 0;
               // queue it
                EvtAddEventToQueue(&event);
                }
         }
         else
            CGrid::HandleEvent(pEvent, bHandled, bResult);

Hope this helps!

Dave Brown

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Mark A.
> Peters
> Sent: Thursday, March 14, 2002 3:12 PM
> To: Palm Developer Forum
> Subject: Re: TblGetItemBounds not reflect row height change?
>
>
> Peter,
>
> I understand that the row height need not match the item height -
> it doesn't
> match in my case either.  The issue I have is that there are two API calls
> (TblSetRowHeight, and _especially_ TblSetRowStaticHeight) that appear to
> exist to set the row height, yet the information they give is ignored in
> some contexts but adhered to in others.
>
> Your idea about TblSetItemHeight might solve the problem, but so would
> having the system not assume or try to calculate the height of a
> cell if the
> cell is custom style, but take it from the information provided
> by the above
> two API calls instead (it already does that for normal cell
> drawing, but not
> for highlighting a selection or cell drawing after highlighting).
>
> Having said that, I have tried processing table/pen events
> myself, and doing
> my own highlighting, but without success so far.  I didn't think the table
> code was in the OS source code, so I didn't look - I will now.
>
> Thanks,
>
> Mark Peters
>
> "Peter Epstein" <[EMAIL PROTECTED]> wrote in message
> news:79926@palm-dev-forum...
> >
> > I agree that the PalmOS tables are weak in this area. But I don't see it
> the
> > way you do. The row height need not match the item heights.
> Each item can
> > have it's own height. What would be nice is a TblSetItemHeight function
> that
> > applies to some item styles such as custom, that don't have any obvious
> item
> > height of their own. Item styles such as label, check-box, and
> field would
> > give errors if this function was called on them.
> >
> > [...]
> >
> > Get access to the OS source code. Look at table.c and see how you can
> > override it's behavior by catching events and processing them yourself.
> For
> > example, instead of letting the table deal with highlighting the row as
> you
> > drag the stylus around, do it yourself with your own EvtGetPen
> loop. Start
> > this up on a TblEnterEvent, and if the pen is inside the row when it is
> > released, generate a TblSelectEvent, just like the code it table.c does.
> In
> > short, use tables but override some of the table logic to get
> the correct
> > behavior. I'm sorry I don't have a more detailed answer. One other
> thought:
> > there may very well be an application out there that has had to
> solve this
> > problem, and whose source code is available. Perhaps a bit of time spent
> on
> > this might be well rewarded.
> > --
> > Peter Epstein
> >
> >
>
>
>
> --
> For information on using the Palm Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/support/forums/
>


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

Reply via email to