I have a DG Table that has a column which displays either a group of squares or a group of circles, depending on the data passed to the column.
Aside from the shape of the graphics, these two groups are identical, and both reside in the Row Template in the correct column's group. Each group also contains an "Add" button, so I can dynamically interact with the group and add another shape into that cell by updating the internal data. The graphics can also be deleted, shifting all subsequent graphics' locations to retain the visual integrity I am aiming for.
Because I want the two groups' behaviors to be exactly identical, I have been writing my Behavior Script handlers with a switch statement that essentially just interacts with the objects of the correct group, based on the case (either Square or Circle).
Simple example: **Note: this code is not where my problem lies; I am merely including it in an attempt to clarify my methodology in this DG.**
Code: Select all
on MouseUp
put the short name of the target into tTarget
switch tTarget
case "Circle"
put the cCircleGroupCustomProperty into tCounter
break
case "Square"
put the cSquareGroupCustomProperty into tCounter
break
end switch
DoStuff tCounter
end MouseUp
I believe the problem has something to do with a procedure the datagrid does to "prime" itself or something... Namely, when I populate a single row of the DG, my LayoutControl script executes ~10 times (until the entire visible portion of the DG is filled with the same initial-state layout). Then, it executes FillInData, finds that there is only one populated line, and suddenly all of the successive lines show empty, like they should.
This is normally fine, but I have noticed that this "initial state" always uses the "Circles" group and not the "Squares" group, even when I have set the visible of the former to false and the latter to true in FillInData (in the cases where I want to populate the cell with squares).
So help me understand: What does the DG do by default? Is LayoutControl supposed to be called recursively before FillInData is called to see if there even should be data displayed?
Hopefully someone can help!
Thanks a million!
Phil E.