Newbie Data Grid question
stephen barncard
stephenREVOLUTION2 at barncard.com
Tue Dec 15 23:02:20 EST 2009
>
> One bit of confusion for me is that there is no dgText property set visible
> here. The syntax
probably a setprop handler.
-------------------------
Stephen Barncard
San Francisco
http://houseofcubes.com/disco.irev
2009/12/15 Jim Ault <jimaultwins at yahoo.com>
> One valuable technique for understanding the DataGrid inner workings.
>
> In Rev, choose the pointer tool, click on a data grid, then go the
> inspector, choose 'custom properties' from the drop down,
>
> and now check out the property sets. You should see dgProps and dgCache
> Note all the properties that have been created when the data grid was
> created.
> Of course you can edit the values here, but you can also change them in
> script lines.
>
> One bit of confusion for me is that there is no dgText property set visible
> here. The syntax
>
> set the dgText [ true ] of group "DataGrid" to tHeaders
>
> would logically mean that there would be a custom property set "dgText"
>
> Interesting if you click on dgProps "row template" you will see:
> group id 1011 of card id 1010 of stack "Data Grid Templates 1260751174078"
>
> ...at least in my version of Rev 3.5
>
> Hope this helps in your travels.
>
> Jim Ault
> Las Vegas
>
>
>
>
> On Dec 15, 2009, at 3:18 AM, Andre.Bisseret wrote:
>
> Bonjour Jim, Trevor and others on this thread ;-)
>>
>> Le 14 déc. 09 à 19:11, James Hurley a écrit :
>> ...
>>
>>>
>>> Trevor (and Andre.Bisseret),
>>>
>>> Thanks you for the very thoughtful reply(s).
>>>
>>> It is heartening to see something defended by its parent. My sincere
>>> apologies for treating your offspring in such a quick and dirty fashion :-)
>>> I'm sure I will appreciate the richness of this new Run Rev object in
>>> time--see below.
>>>
>>> FIrst to satisfy my quick and dirty needs, I find that the following
>>> works well to get data displayed in a data grid field:
>>>
>>> on mouseUp
>>> put field "data" into tData --Tab delimited text
>>> --The first line of tData contains the column names
>>> put line 1 of tData into tHeaders
>>> replace tab with cr in tHeaders
>>> set dgProp["Columns"] of group "DataGrid" to tHeaders --Thanks to Andre
>>> for this line.
>>> set the dgText [ true ] of group "DataGrid" to tData
>>> end mouseUp
>>>
>>> Your handler above, confirmed by Trevoir, helped me a lot to understand
>> the possible uses of pFirstLineContainsHeaders.
>> In order to learn more about data grid, I tried several variations, I put
>> below in case it could interest someone :
>>
>> local tData,tHeaders,
>> -- field "data" = lines of tab delimited text -- a Data Grid "DataGrid"
>> with 3 columns
>> ------------
>>
>> -- 1 ) IF THE LINE OF HEADERS IS NOT INCLUDED IN THE DATA (AS I AM
>> ACCUSTOMED TO)
>> -- 1.1) WITHOUT USING pFirstLineContainsHeaders; WORKS:
>> on mouseUp
>> put "header1" & cr & "header2" & cr & "header3" into tHeaders
>> set the dgProp["columns"] of grp "DataGrid" to tHeaders
>> put fld "data" into tData
>> set the dgText of group "DataGrid" to tData
>> end mouseUp
>>
>> -- 1.2) USING pFirstLineContainsHeaders: USELESS BUT WORKS :-)))
>> on mouseUp
>> put "header1" & cr & "header2" & cr & "header3" into tHeaders
>> set the dgProp["columns"] of grp "DataGrid" to tHeaders
>> put fld "data" into tData
>> set the dgText[false] of group "DataGrid" to tData
>> end mouseUp
>>
>> -- 2) IF, FOR SOME REASON, THE LINE OF HEADERS IS INCLUDED IN THE DATA
>> (FIRST LINE)
>> -- 2.1) WITHOUT USING pFirstLineContainsHeaders: WORKS:
>> on mouseUp
>> put field "data" into tData
>> put line 1 of tData into tHeaders
>> replace tab with cr in tHeaders
>> set dgProp["Columns"] of group "DataGrid" to tHeaders
>> delete line 1 of tData
>> set the dgText of group "DataGrid" to tData
>> end mouseUp
>>
>> -- 2.2) USING pFirstLineContainsHeaders: WORKS:
>> on mouseUp -- the handler from Jim
>> put field "data" into tData
>> put line 1 of tData into tHeaders
>> replace tab with cr in tHeaders
>> set dgProp["Columns"] of group "DataGrid" to tHeaders --Thanks to Andre
>> for this line.
>> set the dgText [ true ] of group "DataGrid" to tData
>> end mouseUp
>> -------------------------------------------------
>> -- indeed, in all these handlers, it's possible to directly set the
>> dgText of grp "datagrid" to fld "data" (but less fast, I guess, specially if
>> it contains a lot of lines)
>> --------------------------------------------------
>> AS FOR THE SYNTAX OF pFirstLineContainsHeaders
>> OK: set the dgText[true]
>> nevertheless:
>> put true into pFirstLineContainsHeaders
>> set the dgText[pFirstLineContainsHeaders] of grp "datagrid" to true
>> works as well, but useless, OK :-)
>>
>> set the pFirstLineContainsHeaders of grp "datagrid" to true does not work
>> as that is creating a custom prop; OK :-))
>>
>> I am a bit slow-witted but I am beginning to understand quite what this
>> pFirstLineContainsHeaders can do ;-o)))))
>>
>> Thanks to both of you,
>>
>> André
>>
>
>
>
> _______________________________________________
> 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