Fixed width table in LC5.5?

Graham Samuel livfoss at mac.com
Sun Apr 1 18:35:47 EDT 2012


Using LC 5.5 on MacOSX Lion 10.7.3, I am trying very minimally to follow the example in the 5.5 Release Notes, where it says:

> vGrid fixed width table mode (5.5 DP1)
> When vGrid is in effect, if the final tabStop has 0 width the engine treats the paragraph as a fixed
> 
> width table, the width being the position of the final tabstop.
> 
> In this mode, the width of the paragraph is considered to be the (fixed) width and this width is used to do the following:
> 
> 	• compute the placement of the table in the line taking into account the textAlign property
> 
> 	• compute the background rectangle to fill with the backColor property
> 
> 	• compute the placement of the border (if any)
> 
> In this mode, rather than borders and background fill going from left margin to right margin, they will instead go from left of the table to right of the table.
> 
> For example, suppose you want a table-like layout with only 5 columns of 50 wide. You can use the following tabStops:
> 
> 50,50,50,50,50,0
> 
> This will result in a table of width 250 pixels.
> 

Well, when I create a mainstack and put a table onto the first (only) card, check that its vGrid is true and do

set the tabStops of fld "myTable" to 50,50,50,50,50,0

The property inspector for the table shows the tab stops to be at 50,100,150,200,250,250, which seems to show that I am actually setting the tabWidths by this statement - seems weird to me. However, the real issue is that I get a table where not all the columns are the same width (the first one is about 2mm wider than the next two, but I suppose this may be the effect of the border), and where the right hand edge can be infinitely extended by dragging, making the fourth column variable rather than fixed.

I also found the IDE freezes frequently during these tests. When I force quit, the 'do you want to Save' dialog appears briefly, but can't be actioned, showing perhaps that the IDE was doing something; but it won't react to mouse clicks. I find that if I reopen my stack and try to switch to the browse tool (I thought of typing something into my table) then the freeze occurs. I have also had a freeze after trying to set the tabWidths and then opening an inspector for the table.

I am not trying to use the full power of the new field object, but merely to make a grid which looks like a spreadsheet table. I liked the idea of a table with a fixed number of columns and rows, and also one where some columns couldn't be written to by the user. Looks like I'm barking up the wrong tree. I have never tackled Datagrids, but this may be the moment.

Anyone else having trouble with this?

Graham

Incidentally, the property 'Cell Formatting" in a table field inspector is not explained in the LC documentation. Does anyone know what it does?





More information about the use-livecode mailing list