Scrolling tables

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Aug 28 05:36:35 UTC 2002


I'm ashamed to admit it, but I'd like a fairly conventional sort
of table widget.

Here's what I want to do.
Given
    anObjectSequence  holding a few to thousands of objects
    aSelectorSequence holding a few unary selectors
        each of which can be sent to any element of anObjectSequence
        and the result will be something that understands asString
and a few other fairly obvious things, I'd like to be able to display

    +-+-----+-----  ... -----+-----+
    |#|x1 s1|x1 s2  ...      |x1 xk|
    | |x2 s1|x2 s2  ...      |x2 sk|
    ...		    ...       ......
    +-+-----+-----  ... -----+-----+

where the first column is a scroll bar (subject to the Preference about
where scroll bars go) and each following column corresponds to one of the
selectors.  The rows correspond to objects in anObjectSequence.
I'd like selection to be by rows, and I'd like a menu item to explore
or inspect the corresponding object.

I can see how to make the tabular structure.
- Make a rectangle morph set up as a row.
- Drop the scrollbar into it.
- for each selector, make a list morph and drop that in.
  (Why organise it this way?  Because I'd like to extend it later
   to offer selective show/hide and reordering of columns, and I'd
   like to provide balloon help for the columns, and so on.)
- The list morphs would have the same number of items, all of which
  would be TextMorphs.  (To tell you the truth, I'm not too sure when
  to use a TextMorph and when to use a StringMorph; the absence of a
  class comment for StringMorph doesn't help.)
- scrolling one "click" up or down would move one row in that direction.
  Initially at least, simply redrawin all the boxes with new contents
  would do; I'd only worry about that if it were a proven problem.

I can see how to make selection be by rows.  Basically it's radio
buttons again.  When a box is selected, everything in the row gets
selected and everything not in that row gets unselected.  (So there
are three "looks": unselected row, selected row but unselected box,
selected box.)

While I can see outlines of this, I don't quite understand how to hook
a ScrollBar up to such a table, and I'm not that clued up on adding menu
items to morphs.

Which tutorials should I read, and where are they?
Has anyone already got a widget like this?  (Not in BobsUI...)




More information about the Squeak-dev mailing list