From e684f8be78e3afaac378d2860756ccd2c62aad82 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 12 Jun 2009 18:29:59 +0000 Subject: [PATCH] Solve issue #1221 and issue #1222: unify window caption and taskbar text, and update them at the right event. --- source/main.pas | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/main.pas b/source/main.pas index 7ac1ede2..38cf5cb4 100644 --- a/source/main.pas +++ b/source/main.pas @@ -1592,8 +1592,6 @@ begin begin winName := winName + Format( ' (%d)', [i] ); end; - Application.Title := winName + ' - ' + APPNAME; - Caption := winName; // Reselect last used database if GetRegValue( REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB ) then begin @@ -3289,7 +3287,6 @@ begin tabEditor.TabVisible := false; tabData.TabVisible := false; - Caption := winName; PageControlMainChange( Self ); end; @@ -3305,7 +3302,6 @@ begin tabEditor.TabVisible := false; tabData.TabVisible := false; - Caption := winName + ' - /' + db; ShowDBProperties( db ); end; @@ -6812,7 +6808,7 @@ end; procedure TMainForm.DBtreeFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex); var - newDb: WideString; + newDb, newDbObject, Cap: WideString; begin debug('DBtreeFocusChanged()'); if not Assigned(Node) then @@ -6828,6 +6824,7 @@ begin end; 2: begin newDb := Databases[Node.Parent.Index]; + newDbObject := SelectedTable.Text; tabEditor.TabVisible := True; tabData.TabVisible := SelectedTable.NodeType in [lntTable, lntCrashedTable, lntView]; if tabEditor.TabVisible then begin @@ -6854,6 +6851,15 @@ begin end; if newDb <> '' then LoadDatabaseProperties(newDb); + // Set window caption and taskbar text + Cap := winName; + if newDb <> '' then + Cap := Cap + ' /' + newDb; + if newDbObject <> '' then + Cap := Cap + '/' + newDbObject; + Cap := Cap + ' - ' + APPNAME + ' ' + FullAppVersion; + Caption := Cap; + Application.Title := Cap; end;