I've got a form with a DB grid on it. It worked fine as a normal TDBGrid, but when I replaced it with the Scalabium TSMDBGrid, I started getting exceptions while loading the form.
Here's the problem, as far as I can track it down:
While loading the columns from the DFM, it attempts to set the Expanded property on the first column to False. This is set in the Form Designer, and can't be changed unless the column is bound to a field representing an ADT or array.
For some reason, the columns are created in the constructor with FExpanded set to true. When the reader reaches this point, it calls TColumn.SetExpanded(false), which does this:
begin
if Value <> FExpanded then
begin
Grid := GetGrid;
WasShowing := (Grid <> nil) and Grid.Columns[Grid.SelectedIndex].Showing;
...
Unfortunately, at this point Grid.SelectedIndex is -1, so I get "Exception class EListError with message 'List index out of bounds (-1)'." This is a pretty clear invariant: SelectedIndex should not be -1 when SetExpanded is called. Does anyone know why the TSMDBGrid is breaking it and what I can do to fix it?