Newbie Data Grid question

Trevor DeVore lists at mangomultimedia.com
Wed Dec 16 00:12:57 EST 2009


On Dec 16, 2009, at 12:04 AM, James Hurley wrote:
>> It's okay, the Data Grid likes to be beta up on once and a while :-)
>
> As long as this is still in Beta, may I make a suggestion?

Sorry, that was supposed to be "beat" not "beta".

> (Does anyone ever let the possibility of the answer be "no" stop  
> them?)
> I had assumed when I saw the following code in the guide:
>
>   put field "data" into tData
>   put true into pFirstLineContainsHeaders
>   set the dgText [ pFirstLineContainsHeaders ] of group "DataGrid 2"  
> to tData
>
> I assumed that  the data grid would function in much the same way  
> that FileMaker does when importing an Excel file, i.e. it allows one  
> to assign the items in the first line of the file to field names and  
> the rest of the llines to populate these fields. That would be a  
> reasonable behavior of "dgText[pFirstLineContainsHeaders]" il.e.  
> when the parameter is true, the column headings are taken from the  
> first line of the text field and the rest go into filling the columns.

The first line is only used to tell the data grid which columns to map  
the rest of the data to. If you want to create columns then you will  
need to set the dgProp["columns"] property.

You can't really use multiple parameters when using setProp (which is  
what dgText is). I'm kind of fudging things a bit by treating dgText  
as a custom property set and pFirstLineContainsHeaders as the custom  
property. The truth is we still don't have access to a very expressive  
syntax when creating custom controls (which the Data Grid is one).

-- 
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com



More information about the Use-livecode mailing list