Skip to content

Commit 0de3296

Browse files
version 3.7.5
- Added property HideSystemCloseButton to TStyledTaskDialog - Added property OnDialogShow - Fixed wordwrap for StyledBitBtn
1 parent 0ec9a81 commit 0de3296

File tree

5 files changed

+55
-30
lines changed

5 files changed

+55
-30
lines changed

README.htm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</style>
3232
<h1>Delphi VCL StyledComponents <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg" alt="License"/></a></h1>
3333
<h2>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!</h2>
34-
<h3>Actual official version: 3.7.4</h3>
34+
<h3>Actual official version: 3.7.5</h3>
3535
<hr />
3636
<h2>A brief description</h2>
3737
<p><strong>StyledComponents</strong> 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.</p>
@@ -347,10 +347,17 @@ <h3>Available from Delphi XE6 to Delphi 12 (32bit and 64bit platforms)</h3>
347347
<p><img src="./Images/SupportingDelphi.jpg" alt="Delphi Support"/></p>
348348
<p>Related links: <a href="https://www.embarcadero.com">embarcadero.com</a> - <a href="https://learndelphi.org">learndelphi.org</a></p>
349349
<h3>RELEASE NOTES</h3>
350+
<p>30 Nov 2024: version 3.7.5</p>
351+
<ul>
352+
<li>Added property HideSystemCloseButton to TStyledTaskDialog</li>
353+
<li>Added property OnDialogShow</li>
354+
<li>Fixed wordwrap for StyledBitBtn</li>
355+
</ul>
350356
<p>10 Nov 2024: version 3.7.4</p>
351357
<ul>
352358
<li>Added tdiQuestion value to show a Question mark in TaskDialog</li>
353359
<li>Use Question Mark (icon ora animation) for MessageDlg and TaskDialog of mtConfirmation type</li>
360+
<li>Fixed Icon Size of Dialogs based on ScaleFactor</li>
354361
<li>Fixed DefaultButton for StyledDialog using MessageDlg and TaskDialog</li>
355362
</ul>
356363
<p>08 Nov 2024: version 3.7.3</p>

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 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!
44

5-
### Actual official version: 3.7.4
5+
### Actual official version: 3.7.5
66

77
---
88
## A brief description
@@ -403,9 +403,15 @@ If you are have Skia4Delphi installed, you can also try the AnimatedTaskDialogDe
403403
Related links: [embarcadero.com](https://www.embarcadero.com) - [learndelphi.org](https://learndelphi.org)
404404

405405
### RELEASE NOTES
406+
30 Nov 2024: version 3.7.5
407+
- Added property HideSystemCloseButton to TStyledTaskDialog
408+
- Added property OnDialogShow
409+
- Fixed wordwrap for StyledBitBtn
410+
406411
10 Nov 2024: version 3.7.4
407412
- Added tdiQuestion value to show a Question mark in TaskDialog
408413
- Use Question Mark (icon ora animation) for MessageDlg and TaskDialog of mtConfirmation type
414+
- Fixed Icon Size of Dialogs based on ScaleFactor
409415
- Fixed DefaultButton for StyledDialog using MessageDlg and TaskDialog
410416

411417
08 Nov 2024: version 3.7.3

source/Vcl.ButtonStylesAttributes.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ interface
5555
;
5656

5757
const
58-
StyledComponentsVersion = '3.7.4';
58+
StyledComponentsVersion = '3.7.5';
5959
DEFAULT_RADIUS = 6;
6060
RESOURCE_SHIELD_ICON = 'STYLED_BUTTON_SHIELD_ADMIN';
6161
DEFAULT_MAX_BADGE_VALUE = 99;

source/Vcl.StyledTaskDialog.pas

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ interface
6868
EStyledTaskDialogException = class(Exception);
6969

7070
{$WARN SYMBOL_PLATFORM OFF}
71-
{ TaskDialog based message dialog; requires Windows Vista or later }
71+
7272
type
73+
TTaskDialogShow = procedure(
74+
const AStyledTaskDialogForm: TForm) of Object;
75+
7376
{ TStyledTaskDialog }
7477
[ComponentPlatforms(pidWin32 or pidWin64)]
7578
TStyledTaskDialog = class(TTaskDialog)
@@ -90,6 +93,8 @@ TStyledTaskDialog = class(TTaskDialog)
9093
FUseAnimations: Boolean;
9194
FUseMessageDefaultButton: Boolean;
9295
FMessageDefaultButton: TMsgDlgBtn;
96+
FDefineDialogSize: TTaskDialogShow;
97+
FHideSystemCloseButton: Boolean;
9398
function IsDefaultFamily: Boolean;
9499
procedure SetAutoClick(const AValue: Boolean);
95100
procedure SetAutoClickDelay(const AValue: Integer);
@@ -126,6 +131,8 @@ TStyledTaskDialog = class(TTaskDialog)
126131
property ButtonsWidth: Integer read FButtonsWidth write SetButtonsWidth default DEFAULT_STYLEDDIALOG_BUTTONSWIDTH;
127132
property ButtonsHeight: Integer read FButtonsHeight write SetButtonsHeight default DEFAULT_STYLEDDIALOG_BUTTONSHEIGHT;
128133
property Flags: TTaskDialogFlags read GetFlags write SetFlags default [tfAllowDialogCancellation, tfPositionRelativeToWindow];
134+
property HideSystemCloseButton: Boolean read FHideSystemCloseButton write FHideSystemCloseButton default False;
135+
property OnDialogShow: TTaskDialogShow read FDefineDialogSize write FDefineDialogSize;
129136
end;
130137

131138
//Abstraction of a Dialog Launcher

source/Vcl.StyledTaskDialogFormUnit.pas

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ TStyledTaskDialogForm = class(TForm)
151151
procedure PlayMessageDlgSound;
152152
procedure FocusDefaultButton;
153153
procedure LoadDialogImage;
154-
procedure SetFocusToButton(AStyledButton: TStyledButton);
155154
procedure SetFooterText(const AValue: string);
156155
function GetFooterText: string;
157156
procedure SetVerificationText(const AValue: string);
@@ -369,7 +368,7 @@ procedure TStyledTaskDialogForm.SetButtons(const AValue: TTaskDialogButtons);
369368
begin
370369
TabOrder := LStyledButton.TabOrder -1;
371370
if LTaskDialogButtonItem.Default then
372-
SetFocusToButton(LStyledButton);
371+
FFocusedButton := LStyledButton;
373372
end;
374373
end;
375374
end;
@@ -420,15 +419,6 @@ procedure TStyledTaskDialogForm.SetFlags(const AValue: TTaskDialogFlags);
420419
end;
421420
end;
422421

423-
procedure TStyledTaskDialogForm.SetFocusToButton(AStyledButton: TStyledButton);
424-
begin
425-
if AStyledButton.CanFocus then
426-
begin
427-
AStyledButton.SetFocus;
428-
FFocusedButton := AStyledButton;
429-
end;
430-
end;
431-
432422
procedure TStyledTaskDialogForm.SetMainIcon(const AValue: TTaskDialogIcon);
433423
begin
434424
if FMainIcon <> AValue then
@@ -537,16 +527,17 @@ procedure TStyledTaskDialogForm.FocusDefaultButton;
537527
var
538528
LButton: TStyledButton;
539529
begin
540-
//if not Assigned(FFocusedButton) then
530+
LButton := GetDefaultButton(DefaultButton);
531+
if not Assigned(LButton) then
532+
LButton := FFocusedButton;
533+
if Assigned(LButton) then
541534
begin
542-
LButton := GetDefaultButton(DefaultButton);
543-
if Assigned(LButton) then
544-
SetFocusToButton(LButton);
545-
end;
546-
if Assigned(FFocusedButton) then
547-
begin
548-
FFocusedButton.AutoClick := FAutoClick;
549-
FFocusedButton.AutoClickDelay := FAutoClickDelay;
535+
if LButton.CanFocus and Self.Visible then
536+
begin
537+
LButton.SetFocus;
538+
LButton.AutoClick := FAutoClick;
539+
LButton.AutoClickDelay := FAutoClickDelay;
540+
end;
550541
end;
551542
end;
552543

@@ -706,6 +697,11 @@ procedure TStyledTaskDialogForm.AdjustWidth;
706697
end;
707698
LFormWidth := LFormWidth + LMargins;
708699
ClientWidth := Max(LWidth, LFormWidth);
700+
//Resize Image based on Scale Factor
701+
ImagePanel.SetBounds(ImagePanel.Left, ImagePanel.Top,
702+
LImageSize, LImageSize);
703+
IconContainer.SetBounds(IconContainer.Left, IconContainer.Top,
704+
LImageSize, LImageSize);
709705
end;
710706

711707
procedure TStyledTaskDialogForm.CalcMessageText(const AExpanded: Boolean);
@@ -981,7 +977,7 @@ procedure TStyledTaskDialogForm.AddCustomButtons(const AButtons: TTaskDialogButt
981977
begin
982978
LStyledButton.Default := True;
983979
Self.ActiveControl := LStyledButton;
984-
SetFocusToButton(LStyledButton);
980+
FFocusedButton := LStyledButton;
985981
end;
986982
if Assigned(LLastButton) then
987983
begin
@@ -1018,7 +1014,7 @@ procedure TStyledTaskDialogForm.AddCustomButtons(const AButtons: TTaskDialogButt
10181014
if (Self.ActiveControl = nil) and Assigned(LLastButton) and (LLastButton.CanFocus) then
10191015
begin
10201016
Self.ActiveControl := LLastButton;
1021-
SetFocusToButton(LLastButton);
1017+
FFocusedButton := LLastButton;
10221018
end;
10231019
end;
10241020

@@ -1065,6 +1061,8 @@ procedure TStyledTaskDialogForm.AdjustControlsTopPos;
10651061
end;
10661062

10671063
procedure TStyledTaskDialogForm.ShowDialogForm;
1064+
var
1065+
LStyledDialog: TStyledTaskDialog;
10681066
begin
10691067
//Initialize components based on ATaskDialog attributes
10701068
FTaskDialogExpanded := FTaskDialog.OnExpanded;
@@ -1076,10 +1074,14 @@ procedure TStyledTaskDialogForm.ShowDialogForm;
10761074
DefaultButton := FTaskDialog.DefaultButton;
10771075
if FTaskDialog is TStyledTaskDialog then
10781076
begin
1079-
FUseMessageDefaultButton := TStyledTaskDialog(FTaskDialog).UseMessageDefaultButton;
1080-
FMessageDefaultButton := TStyledTaskDialog(FTaskDialog).MessageDefaultButton;
1081-
ButtonsWidth := TStyledTaskDialog(FTaskDialog).ButtonsWidth;
1082-
ButtonsHeight := TStyledTaskDialog(FTaskDialog).ButtonsHeight;
1077+
LStyledDialog := TStyledTaskDialog(FTaskDialog);
1078+
//Hide Close button if required
1079+
if LStyledDialog.HideSystemCloseButton then
1080+
BorderIcons := [];
1081+
FUseMessageDefaultButton := LStyledDialog.UseMessageDefaultButton;
1082+
FMessageDefaultButton := LStyledDialog.MessageDefaultButton;
1083+
ButtonsWidth := LStyledDialog.ButtonsWidth;
1084+
ButtonsHeight := LStyledDialog.ButtonsHeight;
10831085
end;
10841086
Buttons := FTaskDialog.Buttons;
10851087
//RadioButtons := FTaskDialog.RadioButtons;
@@ -1314,6 +1316,9 @@ procedure TStyledTaskDialogForm.FormShow(Sender: TObject);
13141316
VerificationCheckBox.Checked := tfVerificationFlagChecked in TaskDialog.Flags;
13151317
if Assigned(FTaskDialog.OnDialogCreated) then
13161318
FTaskDialog.OnDialogCreated(FTaskDialog);
1319+
if (FTaskDialog is TStyledTaskDialog) and
1320+
Assigned(TStyledTaskDialog(FTaskDialog).OnDialogShow) then
1321+
TStyledTaskDialog(FTaskDialog).OnDialogShow(Self);
13171322
finally
13181323
Screen.Cursor := crDefault;
13191324
end;

0 commit comments

Comments
 (0)