[comp.windows.x.motif] Request for multi-column List widget... if it exists.

dorothy@aspect.UUCP (Dorothy Nelson) (01/29/91)

Has anyone mucked about with making a List widget with multiple columns?
I was sort of hoping the talked-about Table widget that David Harrison
wrote would do the trick, but List-like functionality (like selection)
isn't there.  It's more of a formatting tool for widgets (as opposed to
List which doesn't have widget overhead-- it draws the text).

Not to be lazy (yeh, right :-) but in the interests of knowing that I won't
be re-inventing the wheel if I put together this thing together:  does
such a beast exist?


--Dorothy Nelson 		...!uunet!aspect!dorothy

nick@esacs.UUCP (Nikolaos Tsivranidis) (02/05/91)

In article <7456@aspect.UUCP>, dorothy@aspect.UUCP (Dorothy Nelson) writes:
 
> Has anyone mucked about with making a List widget with multiple columns?
> I was sort of hoping the talked-about Table widget that David Harrison
> wrote would do the trick, but List-like functionality (like selection)
> isn't there.  It's more of a formatting tool for widgets (as opposed to
> List which doesn't have widget overhead-- it draws the text).

  You may want to try this:

  Figure out the size of the columns locations of each column in your
  list in character units. Tell the table to spread by the max number
  of characters, and set the position and spread of all widgets 
  accordingly. In other words, use the character size as your
  units, and let the table figure out the rest.

  One thing to look out for: If the table has extra space, it
  will probably put some extra space around the widgets. Since the
  list is a `single' widget it will not find out about this and
  will not place its columns in the right place. To avoid this,
  after the initial setup, you must have a routine that asks the
  table for the location (in FontUnits) of the n'th column.
  Then you can fill the list with extra spaces to align properly.

  So, essentially, you let the table align everything at the
  correct (fontunit) location, you ask it where this location
  is, and *you* align the list columns to that location.
  Of course, all this assumes a fixed size font, which may or
  may not be a severe limitation.

  This solution has one serious drawback in that Resize() will not
  realign the list. Other than that it seems to work fine. You may
  be able to get around this also, by playing with translations.

					- nick -