From 4f4b878e178ffd222ee736f21790a03e2637afdd Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 21 Jul 2016 23:02:08 +0000 Subject: [PATCH] tvplanit: Fix button widths in wavdlg for higher dpi git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5023 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpwavdlg.lfm | 2 +- components/tvplanit/source/vpwavdlg.pas | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/components/tvplanit/source/vpwavdlg.lfm b/components/tvplanit/source/vpwavdlg.lfm index 742ad2d63..ae649c6c7 100644 --- a/components/tvplanit/source/vpwavdlg.lfm +++ b/components/tvplanit/source/vpwavdlg.lfm @@ -56,7 +56,7 @@ object FrmSoundDialog: TFrmSoundDialog TabOrder = 0 end end - object Panel2: TPanel + object ButtonPanel: TPanel Left = 0 Height = 38 Top = 408 diff --git a/components/tvplanit/source/vpwavdlg.pas b/components/tvplanit/source/vpwavdlg.pas index 5d6935e60..6b3d497ae 100644 --- a/components/tvplanit/source/vpwavdlg.pas +++ b/components/tvplanit/source/vpwavdlg.pas @@ -51,7 +51,7 @@ type Label3: TLabel; PageControl1: TPageControl; Panel1: TPanel; - Panel2: TPanel; + ButtonPanel: TPanel; Panel3: TPanel; Panel4: TPanel; RightPanel: TPanel; @@ -86,7 +86,8 @@ type implementation uses - VpSR; + Math, + VpSR, VpMisc; {$IFDEF LCL} {$R *.lfm} @@ -156,6 +157,9 @@ begin end; procedure TFrmSoundDialog.Populate; +var + DIST: Integer = 8; + HBORDER: Integer = 8; begin TabSheet1.Caption := RSSelectASound; Self.Caption := RSSoundFinder; @@ -164,6 +168,14 @@ begin CancelBtn.Caption := RSCancelBtn; Label3.Caption := RSNothingToSelectFrom; Label4.Caption := RSNothingToSelectFrom; + + DIST := ScaleX(DIST, DesignTimeDPI); + HBORDER := ScaleX(HBORDER, DesignTimeDPI); + OKBtn.Width := Max(GetButtonWidth(OKBtn), GetButtonWidth(CancelBtn)); + CancelBtn.Width := OKBtn.Width; + CancelBtn.Left := ButtonPanel.ClientWidth - HBORDER - CancelBtn.Width; + OKBtn.Left := CancelBtn.Left - DIST - OKBtn.Width; + if DingPath = '' then begin CBDefault.Checked := true; if (MediaFolder <> '') and DirectoryExists(MediaFolder) then