data grid code (color)
lists at mangomultimedia.com
Fri Apr 17 21:33:49 EDT 2009
On Apr 17, 2009, at 7:10 PM, Sadhu Nadesan wrote:
> To the fillindata handler, add some code to change the color
> depending on the contents of the cell. Like this
> on FillInData pData
> -- This message is sent when the Data Grid needs to populate
> -- this template with the column data. pData is the value to be
> -- Example:
> set the text of field 1 of me to pData
> if (pData contains "foo") then
> set the backgroundcolor of field 1 of me to "red"
> end if
> end FillInData
> Now run your stack. put 'bar" in column 2, by clicking the populate
> button and answering bar. Nothing should happen. Now do it again
> and answer foo. Again, nothing happens, but the foo cells were
> expected to be red.
> Trevor, is my error obvious to the master? What have I left out!
Your field is transparent so setting the color won't show up. Just set
the opaque flag to true:
if (pData contains "foo") then
set the backgroundcolor of field 1 of me to "red"
set the opaque of field 1 of me to true
set the opaque of field 1 of me to false
I tried this in your test stack in the bug report and it worked.
Blue Mango Learning Systems
www.bluemangolearning.com - www.screensteps.com
More information about the use-livecode