CLIM mail archive


Cell borders in formatting tables

    Date: Wed, 22 Sep 1993 14:17 EDT
    From: Adam Carlson <>

    Clim 1.1 with Allegro 4.1/Lucid 4.1 on Decstation and SPARCstation

    I am trying to get a table that has borders around arbitrary cells, in
    particular I want one that looks like this:

      |  X1  X2  X3
    Y1| 7.2   3   1
    Y2|   2  -5   3
    Y3|   4   2   5

    I first tried using the surrounding-output-with-borders macro to put
    boxes around the X and Y labels, figuring I could write a border type
    for a line on the right hand side of a cell, but the boxes don't show
    up in the right places.  I tried putting the
    surrounding-output-with-borders outside the formatting-cell and inside
    and both gave me the same results.  The boxes are horizontally
    adjacent and each is a few pixels lower than the previous one.  How do
    I arbitrarily put borders around cells in a table?

Putting SURROUNDING-OUTPUT-WITH-BORDERS will definitely not work
properly, because the table formatter's constraint engine won't know to
move the borders.

Putting the borders inside the cells will place borders correctly
(modulo any bugs in CLIM 1.1 -- it works for me in CLIM 2.0), but note
that table cells do not necessarily abut completely adjacent, so using
SURROUNDING-OUTPUT-WITH-BORDERS won't work for adding table rules.

    Also, if you look closely at the demo, you will see that the size of
    the border is determined by the size of the contents in the cell.
    This makes sense if the surrounding-output-with-borders were inside
    the formatting-cell, but if it's outside (as it is in the demo), it
    would be nice if it surrounding the entire area of the cell.  (What if
    I wanted my table in a grid, spreadsheet style?)

SURROUNDING-OUTPUT-WITH-BORDERS is the wrong thing for this.  CLIM
does not presently provide what you want.

    The following is some code that will demonstrate the problem:

Inspired by this mail, I wrote a little piece of code that adds
horizontal or vertical rules to tables.  You specify where you want
the rules by specifying row or column numbers, and the hack puts a
rule before that row or column.  The code only works for CLIM 2.0.
I'll post it at some point if people are interested, but I'm afraid I
don't have time to port it back to CLIM 1.1.


Main Index | Thread Index