From 0de329626f41d27ae60e9b14e801eeb56e6b2b18 Mon Sep 17 00:00:00 2001 From: Carlo Barazzetta Date: Sat, 30 Nov 2024 17:38:37 +0100 Subject: [PATCH] version 3.7.5 - Added property HideSystemCloseButton to TStyledTaskDialog - Added property OnDialogShow - Fixed wordwrap for StyledBitBtn --- README.htm | 9 +++- README.md | 8 +++- source/Vcl.ButtonStylesAttributes.pas | 2 +- source/Vcl.StyledTaskDialog.pas | 9 +++- source/Vcl.StyledTaskDialogFormUnit.pas | 57 ++++++++++++++----------- 5 files changed, 55 insertions(+), 30 deletions(-) diff --git a/README.htm b/README.htm index 9e849f4..f596a3d 100644 --- a/README.htm +++ b/README.htm @@ -31,7 +31,7 @@

Delphi VCL StyledComponents License

Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations!

-

Actual official version: 3.7.4

+

Actual official version: 3.7.5


A brief description

StyledComponents is a set of VCL components for Delphi (32 and 64 bit) that allow you to overcome the limits imposed by standard VCL components, maintaining 100% compatibility of the properties.

@@ -347,10 +347,17 @@

Available from Delphi XE6 to Delphi 12 (32bit and 64bit platforms)

Delphi Support

Related links: embarcadero.com - learndelphi.org

RELEASE NOTES

+

30 Nov 2024: version 3.7.5

+

10 Nov 2024: version 3.7.4

08 Nov 2024: version 3.7.3

diff --git a/README.md b/README.md index af5da76..900da29 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations! -### Actual official version: 3.7.4 +### Actual official version: 3.7.5 --- ## A brief description @@ -403,9 +403,15 @@ If you are have Skia4Delphi installed, you can also try the AnimatedTaskDialogDe Related links: [embarcadero.com](https://www.embarcadero.com) - [learndelphi.org](https://learndelphi.org) ### RELEASE NOTES +30 Nov 2024: version 3.7.5 +- Added property HideSystemCloseButton to TStyledTaskDialog +- Added property OnDialogShow +- Fixed wordwrap for StyledBitBtn + 10 Nov 2024: version 3.7.4 - Added tdiQuestion value to show a Question mark in TaskDialog - Use Question Mark (icon ora animation) for MessageDlg and TaskDialog of mtConfirmation type +- Fixed Icon Size of Dialogs based on ScaleFactor - Fixed DefaultButton for StyledDialog using MessageDlg and TaskDialog 08 Nov 2024: version 3.7.3 diff --git a/source/Vcl.ButtonStylesAttributes.pas b/source/Vcl.ButtonStylesAttributes.pas index 2a91307..2e7b34c 100644 --- a/source/Vcl.ButtonStylesAttributes.pas +++ b/source/Vcl.ButtonStylesAttributes.pas @@ -55,7 +55,7 @@ interface ; const - StyledComponentsVersion = '3.7.4'; + StyledComponentsVersion = '3.7.5'; DEFAULT_RADIUS = 6; RESOURCE_SHIELD_ICON = 'STYLED_BUTTON_SHIELD_ADMIN'; DEFAULT_MAX_BADGE_VALUE = 99; diff --git a/source/Vcl.StyledTaskDialog.pas b/source/Vcl.StyledTaskDialog.pas index 8910c72..3783ab2 100644 --- a/source/Vcl.StyledTaskDialog.pas +++ b/source/Vcl.StyledTaskDialog.pas @@ -68,8 +68,11 @@ interface EStyledTaskDialogException = class(Exception); {$WARN SYMBOL_PLATFORM OFF} -{ TaskDialog based message dialog; requires Windows Vista or later } + type + TTaskDialogShow = procedure( + const AStyledTaskDialogForm: TForm) of Object; + { TStyledTaskDialog } [ComponentPlatforms(pidWin32 or pidWin64)] TStyledTaskDialog = class(TTaskDialog) @@ -90,6 +93,8 @@ TStyledTaskDialog = class(TTaskDialog) FUseAnimations: Boolean; FUseMessageDefaultButton: Boolean; FMessageDefaultButton: TMsgDlgBtn; + FDefineDialogSize: TTaskDialogShow; + FHideSystemCloseButton: Boolean; function IsDefaultFamily: Boolean; procedure SetAutoClick(const AValue: Boolean); procedure SetAutoClickDelay(const AValue: Integer); @@ -126,6 +131,8 @@ TStyledTaskDialog = class(TTaskDialog) property ButtonsWidth: Integer read FButtonsWidth write SetButtonsWidth default DEFAULT_STYLEDDIALOG_BUTTONSWIDTH; property ButtonsHeight: Integer read FButtonsHeight write SetButtonsHeight default DEFAULT_STYLEDDIALOG_BUTTONSHEIGHT; property Flags: TTaskDialogFlags read GetFlags write SetFlags default [tfAllowDialogCancellation, tfPositionRelativeToWindow]; + property HideSystemCloseButton: Boolean read FHideSystemCloseButton write FHideSystemCloseButton default False; + property OnDialogShow: TTaskDialogShow read FDefineDialogSize write FDefineDialogSize; end; //Abstraction of a Dialog Launcher diff --git a/source/Vcl.StyledTaskDialogFormUnit.pas b/source/Vcl.StyledTaskDialogFormUnit.pas index c12660c..1ec92de 100644 --- a/source/Vcl.StyledTaskDialogFormUnit.pas +++ b/source/Vcl.StyledTaskDialogFormUnit.pas @@ -151,7 +151,6 @@ TStyledTaskDialogForm = class(TForm) procedure PlayMessageDlgSound; procedure FocusDefaultButton; procedure LoadDialogImage; - procedure SetFocusToButton(AStyledButton: TStyledButton); procedure SetFooterText(const AValue: string); function GetFooterText: string; procedure SetVerificationText(const AValue: string); @@ -369,7 +368,7 @@ procedure TStyledTaskDialogForm.SetButtons(const AValue: TTaskDialogButtons); begin TabOrder := LStyledButton.TabOrder -1; if LTaskDialogButtonItem.Default then - SetFocusToButton(LStyledButton); + FFocusedButton := LStyledButton; end; end; end; @@ -420,15 +419,6 @@ procedure TStyledTaskDialogForm.SetFlags(const AValue: TTaskDialogFlags); end; end; -procedure TStyledTaskDialogForm.SetFocusToButton(AStyledButton: TStyledButton); -begin - if AStyledButton.CanFocus then - begin - AStyledButton.SetFocus; - FFocusedButton := AStyledButton; - end; -end; - procedure TStyledTaskDialogForm.SetMainIcon(const AValue: TTaskDialogIcon); begin if FMainIcon <> AValue then @@ -537,16 +527,17 @@ procedure TStyledTaskDialogForm.FocusDefaultButton; var LButton: TStyledButton; begin - //if not Assigned(FFocusedButton) then + LButton := GetDefaultButton(DefaultButton); + if not Assigned(LButton) then + LButton := FFocusedButton; + if Assigned(LButton) then begin - LButton := GetDefaultButton(DefaultButton); - if Assigned(LButton) then - SetFocusToButton(LButton); - end; - if Assigned(FFocusedButton) then - begin - FFocusedButton.AutoClick := FAutoClick; - FFocusedButton.AutoClickDelay := FAutoClickDelay; + if LButton.CanFocus and Self.Visible then + begin + LButton.SetFocus; + LButton.AutoClick := FAutoClick; + LButton.AutoClickDelay := FAutoClickDelay; + end; end; end; @@ -706,6 +697,11 @@ procedure TStyledTaskDialogForm.AdjustWidth; end; LFormWidth := LFormWidth + LMargins; ClientWidth := Max(LWidth, LFormWidth); + //Resize Image based on Scale Factor + ImagePanel.SetBounds(ImagePanel.Left, ImagePanel.Top, + LImageSize, LImageSize); + IconContainer.SetBounds(IconContainer.Left, IconContainer.Top, + LImageSize, LImageSize); end; procedure TStyledTaskDialogForm.CalcMessageText(const AExpanded: Boolean); @@ -981,7 +977,7 @@ procedure TStyledTaskDialogForm.AddCustomButtons(const AButtons: TTaskDialogButt begin LStyledButton.Default := True; Self.ActiveControl := LStyledButton; - SetFocusToButton(LStyledButton); + FFocusedButton := LStyledButton; end; if Assigned(LLastButton) then begin @@ -1018,7 +1014,7 @@ procedure TStyledTaskDialogForm.AddCustomButtons(const AButtons: TTaskDialogButt if (Self.ActiveControl = nil) and Assigned(LLastButton) and (LLastButton.CanFocus) then begin Self.ActiveControl := LLastButton; - SetFocusToButton(LLastButton); + FFocusedButton := LLastButton; end; end; @@ -1065,6 +1061,8 @@ procedure TStyledTaskDialogForm.AdjustControlsTopPos; end; procedure TStyledTaskDialogForm.ShowDialogForm; +var + LStyledDialog: TStyledTaskDialog; begin //Initialize components based on ATaskDialog attributes FTaskDialogExpanded := FTaskDialog.OnExpanded; @@ -1076,10 +1074,14 @@ procedure TStyledTaskDialogForm.ShowDialogForm; DefaultButton := FTaskDialog.DefaultButton; if FTaskDialog is TStyledTaskDialog then begin - FUseMessageDefaultButton := TStyledTaskDialog(FTaskDialog).UseMessageDefaultButton; - FMessageDefaultButton := TStyledTaskDialog(FTaskDialog).MessageDefaultButton; - ButtonsWidth := TStyledTaskDialog(FTaskDialog).ButtonsWidth; - ButtonsHeight := TStyledTaskDialog(FTaskDialog).ButtonsHeight; + LStyledDialog := TStyledTaskDialog(FTaskDialog); + //Hide Close button if required + if LStyledDialog.HideSystemCloseButton then + BorderIcons := []; + FUseMessageDefaultButton := LStyledDialog.UseMessageDefaultButton; + FMessageDefaultButton := LStyledDialog.MessageDefaultButton; + ButtonsWidth := LStyledDialog.ButtonsWidth; + ButtonsHeight := LStyledDialog.ButtonsHeight; end; Buttons := FTaskDialog.Buttons; //RadioButtons := FTaskDialog.RadioButtons; @@ -1314,6 +1316,9 @@ procedure TStyledTaskDialogForm.FormShow(Sender: TObject); VerificationCheckBox.Checked := tfVerificationFlagChecked in TaskDialog.Flags; if Assigned(FTaskDialog.OnDialogCreated) then FTaskDialog.OnDialogCreated(FTaskDialog); + if (FTaskDialog is TStyledTaskDialog) and + Assigned(TStyledTaskDialog(FTaskDialog).OnDialogShow) then + TStyledTaskDialog(FTaskDialog).OnDialogShow(Self); finally Screen.Cursor := crDefault; end;