IMHO, forget all about tables and use a list. It's MUCH simpler to implement, and you 
get scrolling automatically, without doing anything to earn it :-). The only reason to 
use a table for something like this is if you want the user to be able to edit it 
in-place.

The only "special" thing you need to do for your particular implementation is have a 
custom list drawing routine that will create columns, and there are lots of examples 
out there on doing this. Note that you won't be storing any content at all in the list 
itself: for instance at form init time you'll do something like:

// assuming you already have the list pointer and the number of items...
LstSetListChoices ( listP, NULL, numListItems );  // note no content in list
LstSetDrawFunction( listP, MyDrawFunc );
LstSetSelection( listP, noListSelection );

And the draw function might be something like:

void MyDrawFunc( Int16 itemNum, RectanglePtr bounds, Char ** /*itemsText*/ )
{
   FontID       oldFont = FntSetFont( stdFont );
        
   if( itemNum > -1)
   {
      // get the name of the item wherever it's stored...
      WinPaintChars( itemName, StrLen( itemName ), bounds->topLeft.x,bounds->topLeft.y 
);
      // more code here to draw the quantity, at some fixed offset from
      // bounds->topLeft.x...
   }
   FntSetFont( oldFont );
}

Hope this helps,

Dave Johnson

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

Reply via email to