DataGrid: Let Data Grid know that first line has column names

Andre.Bisseret Andre.Bisseret at inria.fr
Thu Feb 25 05:18:33 EST 2010


Bonjour Matthias,
I have had the same problem as you can see in the thread that Zryip  
pointed out

Have a look at page 44 in the Trevor' doc; it says:
"Note that if pFirstLineContainsHeaders is true then the columns must  
already exist in your data grid table in order to be displayed."
So you have to create the columns and their name first
Either by hand in the Columns pane of the inspector
or by script as in the following example :
-- drag a new data grid and do :
---------
  put "Name" & cr & "ForeName" into theColNames
    set the dgProp["columns"] of grp "dataGrid 1" to theColNames
---------
Then you can populate it with pFirstLineContainsHeaders like this:
-------
   put "Name" & tab & "ForeName" & cr & "Smith" & tab & "Jim" into  
theData
    set the dgText[true] of grp "dataGrid 1" to theData
--------

Best regards from Genoble

André


Le 24 févr. 10 à 23:15, runrev260805 at m-r-d.de a écrit :

> Hi,
>
> i am fiddling with DataGrids at the moment.  For that i am reading  
> the Revolution_Data_Grid.pdf  and trying out the samples. But i get  
> the sample of page 19 not working
>
> on mouseUp
> ## Create tab delimited data.
> ## Note that first line has name of columns.
> ## Providing names tells Data Grid how to map
> ## data to appropriate columns.
> put "state" & tab & "code" & cr & "ALABAMA" & tab & "AL" & cr &  
> "ALASKA" & tab & "AK" into theText
> ## Let Data Grid know that first line has column names
> put true into firstLineContainsColumnNames
> set the dgText [ firstLineContainsColumnNames ] of group "DataGrid  
> 1" to theText
> end mouseUp
>
> Nothing is put into the DataGrid.
> If i change the line
> put true into firstLineContainsColumnNames
> into
> put false into firstLineContainsColumnNames
> then the Datagrid is filled. Am i doing something wrong?
> Is there a typo in the line? I copied the script directly from the  
> PDF.
>
> Regards,
>
> Matthias
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution






More information about the Use-livecode mailing list