I also put some additional information in the string list resource (say the
first two characters are a 2 digit number) This way I can use item number 6
in the list (as opposed to the 6th item in the list) making my programs more
tolorant of future additions to the list and possible resorting of the
items. Then after locking down the tSTL resource, I can pass the table a
pointer to the 3rd character in the string to display the item.
-----Original Message-----
From: Scott Johnson (WA) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 28, 1999 16:41
To: '[EMAIL PROTECTED]'
Subject: RE: Help: Draw Labels from String List
Some suggestions below...
> From: Elizabeth Chang [mailto:[EMAIL PROTECTED]]
> I want to draw labels from String List to the table object.
> TblSetItemStyle (table, row, 0, labelTableItem);
First, consider using customTableItem style instead of labelTableItem. The
labelTableItem style is hard coded to put a colon ':' at the end of the text
and to use stdFont instead of the current font you set. So you may find it
not very useful. The custom item style lets you supply a draw callback
function where you have full control.
> SysStringByIndex( ... );
Consider _not_ using the SysStringByIndex API at all. Note that it makes a
_copy_ of the requested string into a buffer you provide, which is usually
not desirable unless you plan to modify the copy later. But it sounds like
you are just going to fetch and draw the labels as-is, so you definitely
want to avoid any copying.
Instead, keep the 'tSTL' resource locked for the lifetime of the table and
fetch pointers directly to the strings inside the resource. Then pass those
pointers to TblSetItemPtr (for labelTableItem style) or to WinDrawChars (for
customTableItem style).
-slj-