DataGrid: setting dgProps["column widths"]

Trevor DeVore lists at mangomultimedia.com
Thu May 7 09:15:00 EDT 2009


On May 7, 2009, at 8:45 AM, klaus at major.on-rev.com wrote:

> From the docs:
> ...
> column widths
> - Allows you to set all column widths at once. Line delimited list  
> of integers.
> ...
>
> A couple of qustions:
>
> 1.
> I checked the 10,000,000 lines of script of btn "DataGrid" in your  
> library :-)
> and it looks like this should be a COMMA separated list, right?
> Just like:
> ..
> put the dgProps["column widths"] of grp "DataGrid"
> ..
> -> 120,100,110,50 = COMMA separated list, should be consistent I  
> think.

Yes, it should be a comma delimited list of integers.

The issue is with the repeat loop in the dgProp setprop for "column  
widths". Currently it says:

repeat for each item theColumn in the dgProps["columns"] of me

It should read as follows since columns are line delimited:

repeat for each line theColumn in the dgProps["columns"] of me

If you make the change it should start working.

> 4.
> What will (should) happen if we supply too few/many items in the  
> list like:
> ...
> set the dgProps["column widths"] of grp "DataGrid" to "100,100"
> ## Given there are more or less than 2 columns in the datagrid
> ...

The code loops through the actual columns and assigns the item in the  
list you provide to the width of that column. If you supply to few  
integers then an error will occur. If you supply too many then the  
extras will be ignored.

Regards,

-- 
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Developer Resources: http://revolution.bluemangolearning.com




More information about the use-livecode mailing list