Coloring a line in Data Grid
Posted: Tue Apr 06, 2010 3:27 pm
I want some of my data grid lines to act as headers that cannot be selected and are differentiated from other lines by their color. I have successfully implemented all the features I need, but if the data grid is sized so that the columns are not as wide as the data grid itself, there is a white area on the right hand side. The code I use to color the header lines is:
However the data grid itself knows how to draw the selection for the entire width of the grid. How could this be done through code. Image of problem can be seen here (lines 1 & 4 are headers, line 3 is the selected line:

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.
set the text of the long id of me to pData ## temp workaround for
SetForeGroundColor
end FillInData
setprop dgHilite pBoolean
-- This custom property is set when the highlight of your column template has
-- changed. You only add script here if you want to customize the highlight.
if pBoolean then
set the foregroundcolor of me to empty
end if
end dgHilite
private command SetForeGroundColor
if GetDataOfIndex(the dgIndex of me, "isHeader") then
set the opaque of me to true
set the backgroundColor of me to 152, 206, 131
else
set the opaque of me to false
set the backgroundColor of me to empty
end if
end SetForeGroundColor
