Just sharing:
Yeah, ok. After a decent Christmas and New Years Holiday.
Too easy to use CustomBehaviours.
Add a Custom Column Behavior to a dg Table:
Click on the Pointer+ tool to edit the card.
Double click on the dg to open the properties tool.
Select Columns.
Select the Column you want to add the Custom Column Behavior to.
(if Column Behavior ... button is grey click the + button next to it to add the Custom Column Behavior Script)
The script editor should pop up with the Custom Column Behavior Script.
Just click on the FillnData Routine name in the left panel.
and Try this:
Column "Sat" or "Sun"
Unless there is an easier way to set a Column BackGroundColor to Gray like in a single statement:
Code: Select all
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 displayed.
-- Example:
set the text of field 1 of me to pData
set the opaque of field 1 of me to true -- must set the opaque to true
-- set the backGroundColor of field 1 of me to "White"
-- set the backGroundColor of field 1 of me to 0,0,0 -
-- set the backGroundColor of field 1 of me to LightGray
set the backGroundColor of field 1 of me to Gray95
end FillInData
Column "State" - colors, Bold,
Code: Select all
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 displayed.
-- Example:
set the text of field 1 of me to pData
if pData = "ALASKA" then
set the foregroundcolor of field 1 of me to Green
else if pData = "ALABAMA" then
set the foregroundcolor of field 1 of me to Green
set the textStyle of field 1 of me to Bold
else if pData = "TEXAS" then
set the foregroundcolor of field 1 of me to Red
--set the foregroundcolor of me to Red --does NOT work here
end if
Column "CheckBoxfromFont" - wingdings font - unchecked = numtochar(168) - checked = numtochar(254)
NOTE: Following the LiveCode lesson for DataGrid CheckBox and the LiveCode Lesson DataGridHelper Checkbox are both better (and easier to use via Custom Column Behavior) than using Wingdings font characters
Code: Select all
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 displayed.
-- Example:
set the text of field 1 of me to pData
set the textFont of field 1 of me to "WingDings"
end FillInData
Or maybe the script from the hyperlink in the previous post.