dgText [true] question?
Jim Lambert
jiml at netrin.com
Mon May 4 14:30:26 EDT 2009
This script from tutorial "3389-How-Do-I-Populate-a-Data-Grid-With-
Data-" just doesn't work for me.
answer file "Select iTunes text file:"
put it into theFile
put true into firstLineContainsHeaders
set the dgText [firstLineContainsHeaders] of group "DataGrid 1" to
URL ("file:" & it)
The grid remains empty, no column headers, nada.
set the dgText [FALSE] of group "DataGrid 1" to URL ("file:" & it)
puts the file into the grid but with the header line in row 1 and the
columns labelled "Col 1", etc.
This does work:
answer file "Pick a file:"
if it = "" then exit mouseup
set cursor to busy
put it into cFile
put the hilite of btn "Header?" into hasHeader -- I use a
checkbox to indicate there's a header.
put url ("file:" & it) into tempData
-- now parse the header line and prepare it for dgProp
put line 1 of tempData into cols
replace tab with cr in cols
-- kill the header row
delete line 1 of tempdata
-- set the column names manually
set the dgProp["columns"] of grp "datagrid 1" to cols
-- now set the grid text with as if there is no header.
set the dgText [FALSE] of grp "datagrid 1" to tempdata
I thought the whole idea of 'pFirstLineContainsHeaders' was to handle
the header row automatically.
What am I missing?
Thanks,
Jim Lambert
More information about the use-livecode
mailing list