Tree.Parent is in a special case a form, but it could also turn into some panel or whatever in the future. Be more stable when detecting the origin of the tree.

This commit is contained in:
Ansgar Becker
2011-06-27 23:14:07 +00:00
parent d99fe53f55
commit 752f58ad16

View File

@ -6657,7 +6657,7 @@ begin
end;
end;
lntTable, lntView:
if Sender.Parent is TfrmSelectDBObject then begin
if GetParentFormOrFrame(Sender) is TfrmSelectDBObject then begin
Columns := TTableColumnList.Create(True);
DBObj.Connection.ParseTableStructure(DBObj.CreateCode, Columns, nil, nil);
ChildCount := Columns.Count;
@ -6693,8 +6693,8 @@ begin
2: begin
DBObjects := FConnections[Node.Parent.Parent.Index].GetDBObjects(FConnections[Node.Parent.Parent.Index].AllDatabases[Node.Parent.Index]);
Item^ := DBObjects[Node.Index];
if (Sender.Parent is TfrmSelectDBObject) and (Item.NodeType in [lntTable, lntView]) then
InitialStates := InitialStates + [ivsHasChildren];
if (GetParentFormOrFrame(Sender) is TfrmSelectDBObject) and (Item.NodeType in [lntTable, lntView]) then
Include(InitialStates, ivsHasChildren);
end;
3: begin
Item^ := TDBObject.Create(FConnections[Node.Parent.Parent.Parent.Index]);