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!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
ibe
- VIP Livecode Opensource Backer

- Posts: 61
- Joined: Sun Oct 04, 2009 12:15 pm
Post
by ibe » 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:
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
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:

-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10330
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Wed Apr 07, 2010 3:53 pm
Hi.
The columns in a datagrid are just fields. You could find the total width of those fields and set the width of the group.
Craig Newman
-
trevordevore
- VIP Livecode Opensource Backer

- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
-
Contact:
Post
by trevordevore » Thu Apr 08, 2010 3:00 pm
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.
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder