Expand session tree again after creating a new database and refreshing the tree. Fixes issue #2806

This commit is contained in:
Ansgar Becker
2012-03-29 20:48:03 +00:00
parent 4abe696b14
commit 46497c03e1
2 changed files with 7 additions and 5 deletions

View File

@@ -187,6 +187,7 @@ begin
if modifyDB = '' then try
sql := GetCreateStatement;
FConnection.Query(sql);
MainForm.RefreshTree;
// Close form
ModalResult := mrOK;
except

View File

@@ -1967,9 +1967,7 @@ var
begin
// Create database:
Dialog := TCreateDatabaseForm.Create(Self);
// Rely on the modalresult being set correctly
if Dialog.ShowModal = mrOK then
RefreshTree;
Dialog.ShowModal;
end;
@@ -7358,7 +7356,7 @@ end;
procedure TMainForm.RefreshTree(FocusNewObject: TDBObject=nil);
var
DBNode: PVirtualNode;
OnlyDBNode: Boolean;
OnlyDBNode, Expanded: Boolean;
SessNode: PVirtualNode;
begin
// This refreshes exactly one session node and all its db and table nodes.
@@ -7381,8 +7379,11 @@ begin
FocusNewObject.Connection.ClearAllDbObjects;
FocusNewObject.Connection.RefreshAllDatabases;
SessNode := GetRootNode(DBtree, FocusNewObject.Connection);
if Assigned(SessNode) then
if Assigned(SessNode) then begin
Expanded := DBtree.Expanded[SessNode];
DBtree.ResetNode(SessNode);
DBtree.Expanded[SessNode] := Expanded;
end;
end else begin
FocusNewObject.Connection.ClearDbObjects(FocusNewObject.Database);
DBNode := FindDbNode(DBtree, FocusNewObject.Connection, FocusNewObject.Database);