From b266d1475e5f18a60f1832047a2140edd49f396c Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 30 Mar 2025 12:41:06 +0200 Subject: [PATCH] Issue #1482: high DPI related: call RestoreListSetup in any FormShow event, not FormCreate, move FixVT again to FormShow --- source/connections.pas | 5 +++-- source/extra_controls.pas | 2 +- source/insertfiles.pas | 8 ++++---- source/sqlhelp.pas | 1 + source/usermanager.pas | 6 +++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source/connections.pas b/source/connections.pas index 369f28aa..8fe7d5fc 100644 --- a/source/connections.pas +++ b/source/connections.pas @@ -291,8 +291,6 @@ begin MakeFullyVisible; pnlLeft.Width := AppSettings.ReadInt(asSessionManagerListWidth); splitterMain.OnMoved(Sender); - FixVT(ListSessions); - RestoreListSetup(ListSessions); // Fix GUI stuff HasSizeGrip := True; @@ -401,6 +399,9 @@ var PSess: PConnectionParameters; Node: PVirtualNode; begin + FixVT(ListSessions); + RestoreListSetup(ListSessions); + // Init sessions tree RefreshSessions(nil); diff --git a/source/extra_controls.pas b/source/extra_controls.pas index d16fcfe2..6ef8d36d 100644 --- a/source/extra_controls.pas +++ b/source/extra_controls.pas @@ -326,7 +326,7 @@ begin for i := 0 to ValueList.Count - 1 do begin ColWidth := MakeInt(ValueList[i]); - //ColWidth := RoundCommercial(ColWidth * OwnerForm.ScaleFactor); + ColWidth := OwnerForm.ScaleDesignToForm(ColWidth); // Check if column number exists and width is at least 1 pixel if (List.Header.Columns.Count > i) and (ColWidth > 0) and (ColWidth < 1000) then List.Header.Columns[i].Width := ColWidth; diff --git a/source/insertfiles.pas b/source/insertfiles.pas index ae875510..ad8b89be 100644 --- a/source/insertfiles.pas +++ b/source/insertfiles.pas @@ -120,10 +120,6 @@ begin //DragAcceptFiles(Handle, True); Width := AppSettings.ReadInt(asFileImportWindowWidth); Height := AppSettings.ReadInt(asFileImportWindowHeight); - RestoreListSetup(ListColumns); - RestoreListSetup(ListFiles); - FixVT(ListFiles); - FixVT(ListColumns); end; @@ -138,6 +134,10 @@ end; procedure TfrmInsertFiles.FormShow(Sender: TObject); begin + RestoreListSetup(ListColumns); + RestoreListSetup(ListFiles); + FixVT(ListFiles); + FixVT(ListColumns); FConnection := Mainform.ActiveConnection; Caption := FConnection.Parameters.SessionName + ' - ' + MainForm.actInsertFiles.Caption; comboDBs.Items.Clear; diff --git a/source/sqlhelp.pas b/source/sqlhelp.pas index bebfeddf..b25fe66c 100644 --- a/source/sqlhelp.pas +++ b/source/sqlhelp.pas @@ -240,6 +240,7 @@ begin ChildCount := Results.RecordCount; end; + procedure TfrmSQLhelp.treeTopicsInitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates); var diff --git a/source/usermanager.pas b/source/usermanager.pas index f70c3b6f..6e84dead 100644 --- a/source/usermanager.pas +++ b/source/usermanager.pas @@ -218,9 +218,6 @@ begin Width := AppSettings.ReadInt(asUsermanagerWindowWidth); Height := AppSettings.ReadInt(asUsermanagerWindowHeight); pnlLeft.Width := AppSettings.ReadInt(asUsermanagerListWidth); - FixVT(listUsers); - FixVT(treePrivs); - RestoreListSetup(listUsers); lblWarning.Font.Color := clRed; PrivsRead := Explode(',', 'SELECT,SHOW VIEW,SHOW DATABASES,PROCESS,EXECUTE'); PrivsWrite := Explode(',', 'ALTER,CREATE,DROP,DELETE,UPDATE,INSERT,ALTER ROUTINE,CREATE ROUTINE,CREATE TEMPORARY TABLES,'+ @@ -290,6 +287,9 @@ var end; begin + FixVT(listUsers); + FixVT(treePrivs); + RestoreListSetup(listUsers); FColorReadPriv := clGreen; FColorWritePriv := clMaroon; FColorAdminPriv := clNavy;