Rearranging Data Grid Columns with script

Sarah Reichelt sarah.reichelt at gmail.com
Fri Mar 5 19:05:05 EST 2010


On Sat, Mar 6, 2010 at 6:24 AM, Andrew Kluthe <andrew at rjdfarm.com> wrote:
>
> Is there a way to resize, rearrange, add, or delete columns in a datagrid
> with a script? If so, can you point in a proper direction?

I have done some column resizing & sorting via script - this handler
copies the widths of one data grid's columns to another data grid:

command copyColumnWidths pFrom, pTo
     put the dgProp["columns"] of group pFrom into tCols
     repeat for each line L in tCols
          put the dgColumnWidth[L] of grp pFrom into tColWidth
          set the dgColumnWidth[L] of grp pTo to tColWidth
     end repeat
end copyColumnWidths

I haven't re-arranged, added or deleted, but if you go to
<http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7343-Data-Grid-Properties>
you can see listed all the properties of the data grid and it's
columns and how you can set them.

HTH,
Sarah



More information about the use-livecode mailing list