[comp.sys.mac.programmer] List Mgr with TCL

mjf@well.sf.ca.us (Marty Fried) (05/28/91)

Can anyone offer advice on using the List Mgr with TCL?  I am using it
in a floating window, and have at least one problem.  It won't display
the list until I resize the window.  It then works fine until I either
obscure certain parts of it, or re-enable it after switching to another
window (which makes this one disappear).  The lUpdate function gets called,
but nothing happens.  I've been able to make it display initially, by using
a begin/end update, but then it just sits there and ignores me (it does get
sent the lClick message, though).  Could it have something to do with the
update regions?  I'm still somewhat of a novice, and I don't fully understand
how this works. Is there more than one update region?  It seems like there
may be.  Are they available for viewing in the debugger?  
 One thing that confuses me.  The lUpdate function requires the ListHandle and
the RgnHandle.  Is the RgnHandle the same one that is available by examining
the port structure in the list record?  If so, why pass both, when just the
listHandle should suffice?
 To use the LM, I did a subclass of CWindow, and added the code for lUpdate,
lActivate, and lClick to the CWindow's appropriate (I think) methods.  I've
tried various orders of doing this, but nothing seems to fully work.  Does
my strategy make sense?  Do I make sense? :)  
 I would be very grateful if anyone can give me suggestions.  I've read and
reread everything I could find on the subject, with no help.  And once I
resize the window, it works correctly.
 BTW, it is a color-selection palette, that displays colors in boxes, with
the name of the color adjacent to the box.
   Marty Fried                 +-+-+-+-+-+-+-+-+-+-+-+
   SlideTek, Inc.              + This space for rent +
   Sausalito, Calif.           +-+-+-+-+-+-+-+-+-+-+-+

minow@ranger.enet.dec.com (Martin Minow) (05/28/91)

In article <25064@well.sf.ca.us>, mjf@well.sf.ca.us (Marty Fried) asks
about using the ListManger with TCL.

I tried that and, eventually, gave up chasing small bugs (scrolling
worked in one direction only...) It turned out to be simpler (and
more flexible) to build that has, roughly, the following organization:

-- ListPanorama -- this is a CSelector sub-class with three extra
	instance variables: aCommandBase, aDoubleClickCmd, and aBoxHeight.
	It creates a CScrollPane that encloses a CBorder that, in turn,
	encloses the CSelector.
	aCommandBase is passed to CSelector::ISelector.
	aBoxHeight is used to set the CScrollPane vertical scale.
	aDoubleClickCmd will be passed to the ListPanorama's supervisor
	by a DoDoubleClick method.
	The Selector also requires you to override Draw, DrawItem, HiliteItem,
	FindItem, and FindItemBox methods.
-- ListSelector -- this is a CList subclass that has an an InstallSelector
	method. InstallSelector links the ListSelector to its associated
	ListPanorama.  There is also an AdjustSelector method that is
	called whenever the number of items changes.  I also implemented
	GetSelection, ChangeSelection, Append, Remove, Prepend, InsertAfter,
	and InsertAt methods.

Linking the ListPanorama and ListSelector allows each class hierarchy
to work independently, but cooperatively.

Martin Minow
minow@ranger.enet.dec.com