zero-width column boundaries?

Martin Baxter mb.ur at
Wed Sep 20 17:23:06 EDT 2006

Richard Gaskin wrote:
> Anyone know of a way to make column boundaries using the vGrid property 
> but which aren't visible?
> I have some fields in which most of the content is just plain blocks of 
> text, but a part of it contains tabular data.  Getting it to line up 
> properly on both platforms has been problematic, as some of the cell 
> contents run flush to the next column, and the differences in font 
> metrics make for unpredictable differences between developing on one 
> platform and deploying on another.
> I've thought about turning on the vGrid, but although it solves the 
> problem for the tables it puts visible lines through the blocks of plain 
> text.
> I may just have to go with breaking the text into multiple fields, but 
> this is a last resort as it would greatly complicate the architecture of 
> the software.
> Any suggestions welcome....

Hi Richard,

Are you wanting to fit the column widths to the data?

If so, what I do is calculate the tabstops on the fly by examining the 
data. It works amazingly well for my admittedly simple needs.

It goes like this

For each column, whose content varies in width, I take the
formattedwidth of the cell (item) that has the most characters and add
12 in order to ensure that there is a bit of clear space between the
last character and the start of the next column, including a bit extra
to leave room for variations inherent in proportionally spaced text.

The optimal number of pixels to add would depend on your particular
situation of course.

A more thorough approach might be, rather than just counting characters 
of data, to loop through every item and get it's formatted width, take 
the max for each column and add a few pixels padding to set its tabstop. 
I Haven't tried that myself because I don't need to, but you might want 
to if the text you are fitting is long enough that proportional text 
variation is an issue. I suspect it could work.

Well, you did say "any suggestions..."

Martin Baxter

More information about the Use-livecode mailing list