[comp.windows.x.motif] Help building table of text/label widgets

mdv@comtst.UUCP (Mike Verstegen) (12/11/90)

I'm trying to build a table that looks like this with about 10 rows
of a label plus three columns of data as shown below.

                 Col1Hdg    Col2Hdg    Col3Hdg
Row1Label       R1C1data   R1C2data   R1C3data
Row2Label       R2C1data   R2C2data   R2C3data
Row3Label       R3C1data   R3C2data   R3C3data
...

Note that the Row labels and column headings are of differing width
than each other and different than the width of the data.

I've tried the following approaches with varying degrees of success.

  - XmForm with each cell attached to the cell above and to the left
    using (XmLeftAttachment = XmATTACH_WIDGET, etc.). This seems to be
    too "brute force" because there are 44 cells which would take 88
    attachments. 

  - XmRowColumn using XmPACK_COLUMN but since that RowXLabel is much
    wider than the data, the table is too wide.
  
  - XmRowColumn with XmNorientation = XmVERTICAL where each item in the
    column is another XmHORIZONTAL XmRowColumn containing each row. The
    problem with this is that the columns won't line up because the
    RowXLabels are of differing width without hardcoding in the XmNwidth
    of the RowXLabels by trial and error (seems non-portable, particularly
    with respect to font changes).

This seems to be something that has been done before, and after beating
my head against the wall too long, I'll finally ask if someone has a
better solution to this problem.

Configuration: Motif 1.0, X11R3, ISC Unix 2.0.2

Thanks,
Mike
-- 
Mike Verstegen          Domain Systems, Inc           Voice +1 407 686-7911
..!uunet!comtst!mdv     5840 Corporate Way #100       Fax   +1 407 478-2542
mdv@domain.com          West Palm Beach, FL 33407

meeks@osf.org (W. Scott Meeks) (12/12/90)

>From: comtst!mdv@uunet.uu.net  (Mike Verstegen)
>
>I'm trying to build a table that looks like this with about 10 rows
>of a label plus three columns of data as shown below.
>
>                 Col1Hdg    Col2Hdg    Col3Hdg
>Row1Label       R1C1data   R1C2data   R1C3data
>Row2Label       R2C1data   R2C2data   R2C3data
>Row3Label       R3C1data   R3C2data   R3C3data
>...
>
>Note that the Row labels and column headings are of differing width
>than each other and different than the width of the data.
>
>

How about:

XmRowColumn with XmNorientation = XmHORIZONTAL where each item in the RC
is another XmVERTICAL XmRowColumn containing each column of information.
So the first column would contain a blank label and then each of the
RowXLabel labels.  The second column would contain Col1Hdg and then
RXC1data and so on.  This will let you align each column of data however
you like yet allow each column to be a different width and even change
width if the longest entry changes size.  

Hope this helps.  Let me know if you have any questions.

. Scott Meeks
Open Software Foundation
meeks@osf.org
(617) 621-7229

david@jpl-devvax.JPL.NASA.GOV (David E. Smyth) (12/12/90)

meeks@osf.org (W. Scott Meeks) writes:
>>From: comtst!mdv@uunet.uu.net  (Mike Verstegen)
>>
>>I'm trying to build a table that looks like this with about 10 rows
>>of a label plus three columns of data as shown below.
>>
>>                 Col1Hdg    Col2Hdg    Col3Hdg
>>Row1Label       R1C1data   R1C2data   R1C3data
>>Row2Label       R2C1data   R2C2data   R2C3data
>>Row3Label       R3C1data   R3C2data   R3C3data
>>...
>>
>>Note that the Row labels and column headings are of differing width
>>than each other and different than the width of the data.
>
>How about:
>
>XmRowColumn with XmNorientation = XmHORIZONTAL where each item in the RC
>is another XmVERTICAL XmRowColumn containing each column of information.

How about using the Table widget.  This is the perfect use.  It's
got some bugs right now involving geometry management when used with
Motif (it does not shrink nicely anymore).  Kee claims to be working 
on it, so I am not ;^)

Table can be had from Kee or within the Wcl distribution from 
expo.lcs.mit.edu:/contrib/Wcl1_04.tar.Z

-------------------------------------------------------------------------
David Smyth				david@jpl-devvax.jpl.nasa.gov
Senior Software Engineer,		seismo!cit-vax!jpl-devvax!david
X and Object Guru.			(818)393-0983
Jet Propulsion Lab, M/S 230-103, 4800 Oak Grove Drive, Pasadena, CA 91109
--------------------------- Quote of the Day: ---------------------------
   "A Guru is not one who simply knows all the answers.  Rather, a
    Guru is like one who walks among the mountains, and by wandering
    around abit, can see the horizon through long narrow canyons."
-------------------------------------------------------------------------