LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
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:
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
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:
Hmm, this is an interesting problem. There are no actual column controls in area where no columns are displayed (to the right of col 5 in your example). Just a graphic named dgAlternatingRows that is used to display alternating row colors.
I think your best option right now is to resize the width of column 5 so that it fills the rest of the width (set the dgColumnWidth["col 5"] of ...)
It would probably be nice if you could specify a color for a row though. The data grid would then draw the row color for you automatically.