Table fields... oh boy.

J. Landman Gay jacque at hyperactivesw.com
Sun Aug 15 12:49:18 EDT 2004


On 8/14/04 11:12 PM, Troy Rollins wrote:

> 
> On Aug 14, 2004, at 1:30 PM, J. Landman Gay wrote:
> 
>> I built one of these some years ago:
>>
>> <http://www.hyperactivesw.com/downloads/pseudtbl.mc.hqx>
>>
>> You'll probably want to adjust the behavior, but it might get you 
>> started. The method has some limitations but can work in the right 
>> circumstances.
> 
> 
> I grabbed that demo, and I must say, it is really nice, and very 
> impressive. That said, with no intent to snub the obvious expertise, it 
> is hundreds of lines of custom code, which delivers a one-off solution, 
> which still does not really behave like a "standard" data grid. This 
> leads me only to believe that without a built-in solution, a generically 
> useful and practical data grid is simply beyond our current capabilities.

No offense taken; the demo was written to address a particular need and 
it isn't suitable for all applications. It did what I needed it to do in 
one of my projects.

That said, I think it is possible to write just about any type of grid 
in Transcript, though as you say it could be time-consuming. I've also 
done Excel-type interfaces, where an editable field accepts user input 
and then places that input into a tabbed-field table object. This solves 
the problem of editing "cells"; all editing is done inside the entry 
field. If Excel can do it, so can I, and users are generally used to 
this type of editing.

Single-line data tables such as iTunes uses are easy to make. Just trap 
the tabKey message and insert a return character if the insertion point 
is in the last "cell". You can sort the field by column using standard 
"sort" syntax ("sort field 1 by item 3 of each", etc.) You can resize 
columns by resetting tabstops. I do this routinely. You can even create 
a "header" field that allows the user to drag out the columns to the 
widths they want, and when they release the mouse, set your data grid to 
the same tabstops (there are several different ways to implement the HIG 
for this.) Or resize the grid dynamically during the header drag; Rev is 
fast enough to do it.

If neither of these types of grid are what you need, tell us what you 
are looking for. There is nearly always a way to script it.

Real "table objects" are on the requested feature list, and I know the 
team has been considering how to implement them. It is a difficult thing 
to create, but I believe the plan is to try to build one for a future 
release. Meanwhile, most of us have been scripting our own solutions for 
years. It can be done.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list