Hi Klaus,
(and anyone else crazy enough to try customizing a datagrid!)
I've made progress, and uncovered some oddities, so this may be of interest to someone at some point. Here's what I've done and what I've learned...
First; I scrapped my DG, and created a new one, using a different name "GrpGrid" and accepting the default column names. In my case "Col 1" thru "Col 7".
Without doing any kind of customization, my data loads and displays fine. There are about 200 records for the 20 or so display rows, so I have a vertical scroll bar.
Next, I selected "Col 1" in the property inspector and clicked the '+' to add custom behavior. The "Column Behavior" button became un-grayed, so I clicked that too. Nothing happened.
So I did the same thing with "Col 2" and sure enough a "Col 2 Behavior" script popped-up in the editor window. The same happened in all the other columns, but I was still unable to get a script I could modify for Col 1.
Thinking I may at some point want to customize all the columns, I then created a dummy non-visible "Col 8".
It seems that whatever is the first field you try to modify, you can't!
So I clicked first on "Col 8" and then on the other columns. So now I have customizable "Column Behavior" scripts for all my visible columns, i.e. "Col 1" thru "Col 7".
Next, I started to modify the FillInData handler for Col 2. In my case that column is either blank, or contains the text "START" or "END". I want these to be green and red text respectively. I decided to start with just the green.
The default code is as follows:
Code: Select all
on FillInData pData
set the text of field 1 of me to pData
end FillInData
So I changed it to:
Code: Select all
on FillInData pData
set the text of field 1 of me to pData
if pData = "START" then
set the foregroundcolor of field 1 of me to 0,255,0
end if
end FillInData
I thought that was working, but I noticed when I scrolled up & down all the text became green. From this I figured I must be coloring the visible cells, rather than the actual text. So I added the "END" coding:
Code: Select all
on FillInData pData
set the text of field 1 of me to pData
if pData = "START" then
set the foregroundcolor of field 1 of me to 0,255,0
else
if pData = "END" then
set the foregroundcolor of field 1 of me to 255,0,0
end if
end if
end FillInData
Bingo! Red & Green text, as needed.
It seems that if you choose to color any text, you must color all the text. In my case I didn't need to color the blank areas

altho I did think about it
I have to say, this is actually a lot easier than any of the examples and tutorials I've found.
(At this point I was going to report a major problem. Having added the above code, I couldn't scroll the fields. I could move the scroll bar, but the data didn't change. Removing my custom code didn't help. But as I was typing this message LC decided it had encountered an unexpected error and crashed. When I restarted it, the scolling now works correctly. Hopefully this was a not-to-be-repeated anomoly.)
One minor problem was that any column for which I said I wanted customized behavior, the text was now left justified. In the property inspector, I selected "Center" for all columns. Deciding to have custom behavior overrides this.
One of the cards in the DG Template has a controls called "_ColumnData_" for each column. Displaying this in the Property Inspector allows you to set all the same column settings you can set for the original DG columns. (Does that make sense?)
Anyways, I am pretty-much at the point I want to be ... albeit a week later than I would have liked.
Many thanks Klaus for all your input. I wouldn't have reached this point without you.
One last thought... Does anyone know how to customize the background of the cells? I haven't yet found a way to do this.
--paul