From 4bbe7b789e6eaaf5e0e4f6bfd3b3804017dbce87 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 5 Apr 2020 10:49:54 +0200 Subject: [PATCH] Auto-resize width of bottom right buttons on session manager, to make room for longer translations. See https://www.heidisql.com/forum.php?t=35862 --- source/connections.pas | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/connections.pas b/source/connections.pas index 63dc990c..5a84b561 100644 --- a/source/connections.pas +++ b/source/connections.pas @@ -11,7 +11,8 @@ interface uses Windows, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, VirtualTrees, Menus, Graphics, Generics.Collections, ActiveX, extra_controls, Messages, - dbconnection, gnugettext, SynRegExpr, System.Types, Vcl.GraphUtil, ADODB, StrUtils; + dbconnection, gnugettext, SynRegExpr, System.Types, Vcl.GraphUtil, ADODB, StrUtils, + System.Math; type Tconnform = class(TExtForm) @@ -1360,7 +1361,7 @@ procedure Tconnform.splitterMainMoved(Sender: TObject); var ButtonWidth: Integer; begin - // Splitter resized - adjust width of buttons + // Splitter resized - adjust width of bottom left buttons ButtonWidth := Round((pnlLeft.Width - 2 * pnlLeft.Margins.Left) / 3); btnNew.Width := ButtonWidth; btnSave.Width := ButtonWidth; @@ -1368,6 +1369,17 @@ begin btnNew.Left := pnlLeft.Left; btnSave.Left := btnNew.Left + btnNew.Width + pnlLeft.Margins.Left; btnDelete.Left := btnSave.Left + btnSave.Width + pnlLeft.Margins.Left; + + // Resize bottom right buttons + ButtonWidth := Round((PageControlDetails.Width - 2 * PageControlDetails.Margins.Right) / 3); + ButtonWidth := Max(ButtonWidth, 50); + ButtonWidth := Min(ButtonWidth, 100); + btnMore.Width := ButtonWidth; + btnCancel.Width := ButtonWidth; + btnOpen.Width := ButtonWidth; + btnmore.Left := PageControlDetails.Left + PageControlDetails.Width - btnMore.Width; + btnCancel.Left := btnMore.Left - btnMore.Width - PageControlDetails.Margins.Right; + btnOpen.Left := btnCancel.Left - btnCancel.Width - PageControlDetails.Margins.Right; end;