Adding Columns to a Datagrid via Script

zryip theSlug zryip.theslug at gmail.com
Fri Jan 21 14:02:00 EST 2011


On Fri, Jan 21, 2011 at 7:36 PM, Ray Horsley <ray at linkit.com> wrote:
> Really?  So there's no way other than this to add columns to a datagrid and,
> even more disappointing, there's no way at all to set column names from a
> script?

Ray,

You can by setting the dgProp["columns"]  of a datagrid. This property
returns the names of the columns separated by returns.

Here is an example adding a column with an asking name at the end of a datagrid


command addColumn pWhichDG
   local tDGColumnsList, tNewColNo, tNewColName

   put the dgProp["columns"] of grp pWhichDG into tDGColumnsList
   put (the number of lines of tDGColumnsList + 1) into tNewColNo
   ask "Column name?" with "Col" & tNewColNo
   if (it is not empty) then
      put it into tNewColName
      set the dgProp["columns"] of grp pWhichDG to tDGColumnsList &
return & tNewColName
   end if
end addColumn


Best regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc




More information about the use-livecode mailing list