Skip to content

Commit 38f265d

Browse files
version 3.8.3
- TStyledTaskDialog enhanced and fixed: - > "Flags" property default same as TTaskDialog - > moved Position and MainIconSize from public to published - > moved Handle property from published to public - > fixed "Custom position" of TaskDialog using "Position" property - > Inside OnDialogCreated is possible to set Position - DialogForm enhanced and fixed: - > Fixed MinHeight - > Fixed position of Dialog based on tfPositionRelativeToWindow flag
1 parent d690921 commit 38f265d

8 files changed

+125
-121
lines changed

Demos/source/StyledDbNavigatorFormOld.vlb

Lines changed: 0 additions & 3 deletions
This file was deleted.

Demos/source/StyledDialogDemoForm.dfm

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,8 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
507507
't laborum.'
508508
Title = 'Task Dialog Tester'
509509
VerificationText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
510-
OnButtonClicked = TaskDialogButtonClicked
511-
OnDialogConstructed = TaskDialogDialogConstructed
512510
OnDialogCreated = TaskDialogDialogCreated
513-
OnDialogDestroyed = TaskDialogDialogDestroyed
514-
OnExpanded = TaskDialogExpanded
515511
OnHyperlinkClicked = TaskDialogHyperlinkClicked
516-
OnNavigated = TaskDialogNavigated
517512
OnRadioButtonClicked = TaskDialogRadioButtonClicked
518513
OnTimer = TaskDialogTimer
519514
OnVerificationClicked = TaskDialogVerificationClicked
@@ -564,13 +559,8 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
564559
't laborum.'
565560
Title = 'Task Dialog Tester'
566561
VerificationText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
567-
OnButtonClicked = TaskDialogButtonClicked
568-
OnDialogConstructed = TaskDialogDialogConstructed
569562
OnDialogCreated = TaskDialogDialogCreated
570-
OnDialogDestroyed = TaskDialogDialogDestroyed
571-
OnExpanded = TaskDialogExpanded
572563
OnHyperlinkClicked = TaskDialogHyperlinkClicked
573-
OnNavigated = TaskDialogNavigated
574564
OnRadioButtonClicked = TaskDialogRadioButtonClicked
575565
OnTimer = TaskDialogTimer
576566
OnVerificationClicked = TaskDialogVerificationClicked

Demos/source/StyledDialogDemoForm.pas

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,8 @@ TfmStyledTaskDialog = class(TForm)
9191
procedure UseStyleDialogCompClick(Sender: TObject);
9292
procedure FontComboBoxSelect(Sender: TObject);
9393
procedure RaiseDatabaseError(Sender: TObject);
94-
procedure TaskDialogButtonClicked(Sender: TObject;
95-
ModalResult: TModalResult; var CanClose: Boolean);
96-
procedure TaskDialogDialogConstructed(Sender: TObject);
9794
procedure TaskDialogDialogCreated(Sender: TObject);
98-
procedure TaskDialogDialogDestroyed(Sender: TObject);
99-
procedure TaskDialogExpanded(Sender: TObject);
10095
procedure TaskDialogHyperlinkClicked(Sender: TObject);
101-
procedure TaskDialogNavigated(Sender: TObject);
10296
procedure TaskDialogRadioButtonClicked(Sender: TObject);
10397
procedure TaskDialogVerificationClicked(Sender: TObject);
10498
procedure InitializeDialogsClick(Sender: TObject);
@@ -469,32 +463,11 @@ procedure TfmStyledTaskDialog.UseStyleDialogCompClick(Sender: TObject);
469463
ShowSelection(LTaskDialog.ModalResult);
470464
end;
471465

472-
procedure TfmStyledTaskDialog.TaskDialogButtonClicked(Sender: TObject;
473-
ModalResult: TModalResult; var CanClose: Boolean);
474-
begin
475-
;
476-
end;
477-
478-
procedure TfmStyledTaskDialog.TaskDialogDialogConstructed(Sender: TObject);
479-
begin
480-
;
481-
end;
482-
483466
procedure TfmStyledTaskDialog.TaskDialogDialogCreated(Sender: TObject);
484467
begin
485468
EnableAndFocusOKButton(Sender as TCustomTaskDialog);
486469
end;
487470

488-
procedure TfmStyledTaskDialog.TaskDialogDialogDestroyed(Sender: TObject);
489-
begin
490-
;
491-
end;
492-
493-
procedure TfmStyledTaskDialog.TaskDialogExpanded(Sender: TObject);
494-
begin
495-
;
496-
end;
497-
498471
procedure TfmStyledTaskDialog.TaskDialogHyperlinkClicked(Sender: TObject);
499472
var
500473
LURL: String;
@@ -503,11 +476,6 @@ procedure TfmStyledTaskDialog.TaskDialogHyperlinkClicked(Sender: TObject);
503476
ShellExecute(Self.Handle, 'open' , PChar(LURL), nil, nil, SW_SHOW );
504477
end;
505478

506-
procedure TfmStyledTaskDialog.TaskDialogNavigated(Sender: TObject);
507-
begin
508-
;
509-
end;
510-
511479
procedure TfmStyledTaskDialog.TaskDialogRadioButtonClicked(Sender: TObject);
512480
var
513481
LTaskDialog: TCustomTaskDialog;
@@ -522,10 +490,7 @@ procedure TfmStyledTaskDialog.TaskDialogRadioButtonClicked(Sender: TObject);
522490

523491
procedure TfmStyledTaskDialog.TaskDialogTimer(Sender: TObject; TickCount: Cardinal; var Reset: Boolean);
524492
begin
525-
// TaskDialog1.ProgressBar.Position := MyThread.CurrentProgressPercent;
526-
// Demo
527-
//TaskDialog.ProgressBar.Position := TaskDialog.ProgressBar.Position + 1;
528-
TaskDialog.Execute(Self.Handle);
493+
TaskDialog.Execute(Self.Handle);
529494
end;
530495

531496
function TfmStyledTaskDialog.EnableAndFocusOKButton(const ATaskDialog: TCustomTaskDialog): Boolean;

README.htm

Lines changed: 27 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.8.2</h3>
34+
<h3>Actual official version: 3.8.3</h3>
3535
<hr />
3636
<h2>New Setup for Installation of Components</h2>
3737
<p>From 3.8.1 version a new &ldquo;Installer&rdquo; read-to-use is located in the Release area: <a href="https://github.com/EtheaDev/StyledComponents/releases/latest/download/StyledComponents_Setup.exe">Download the Installer</a>.</p>
@@ -344,6 +344,32 @@ <h3>Available from Delphi XE6 to Delphi 13 (32bit and 64bit platforms)</h3>
344344
<p><img src="./Images/SupportingDelphi.jpg" alt="Delphi Support"/></p>
345345
<p>Related links: <a href="https://www.embarcadero.com">embarcadero.com</a> - <a href="https://learndelphi.org">learndelphi.org</a></p>
346346
<h3>RELEASE NOTES</h3>
347+
<p>23 Aug 2025 - version 3.8.3</p>
348+
<ul>
349+
<li>TStyledTaskDialog enhanced and fixed:</li>
350+
<li><blockquote><p>&ldquo;Flags&rdquo; property default same as TTaskDialog</p>
351+
</blockquote>
352+
</li>
353+
<li><blockquote><p>moved Position and MainIconSize from public to published</p>
354+
</blockquote>
355+
</li>
356+
<li><blockquote><p>moved Handle property from published to public</p>
357+
</blockquote>
358+
</li>
359+
<li><blockquote><p>fixed &ldquo;Custom position&rdquo; of TaskDialog using &ldquo;Position&rdquo; property</p>
360+
</blockquote>
361+
</li>
362+
<li><blockquote><p>Inside OnDialogCreated is possible to set Position</p>
363+
</blockquote>
364+
</li>
365+
<li>DialogForm enhanced and fixed:</li>
366+
<li><blockquote><p>Fixed MinHeight</p>
367+
</blockquote>
368+
</li>
369+
<li><blockquote><p>Fixed position of Dialog based on tfPositionRelativeToWindow flag</p>
370+
</blockquote>
371+
</li>
372+
</ul>
347373
<p>19 Aug 2025 - Version 3.8.2</p>
348374
<ul>
349375
<li>Added progressbar to StyledDialog component</li>

README.md

Lines changed: 12 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.8.2
5+
### Actual official version: 3.8.3
66

77
---
88
## New Setup for Installation of Components
@@ -396,6 +396,17 @@ If you are have Skia4Delphi installed, you can also try the AnimatedTaskDialogDe
396396
Related links: [embarcadero.com](https://www.embarcadero.com) - [learndelphi.org](https://learndelphi.org)
397397

398398
### RELEASE NOTES
399+
23 Aug 2025 - version 3.8.3
400+
- TStyledTaskDialog enhanced and fixed:
401+
- > "Flags" property default same as TTaskDialog
402+
- > moved Position and MainIconSize from public to published
403+
- > moved Handle property from published to public
404+
- > fixed "Custom position" of TaskDialog using "Position" property
405+
- > Inside OnDialogCreated is possible to set Position
406+
- DialogForm enhanced and fixed:
407+
- > Fixed MinHeight
408+
- > Fixed position of Dialog based on tfPositionRelativeToWindow flag
409+
399410
19 Aug 2025 - Version 3.8.2
400411
- Added progressbar to StyledDialog component
401412
- Fixed Sort for TStyledToolButtons in 64 bit

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.8.2';
58+
StyledComponentsVersion = '3.8.3';
5959
DEFAULT_RADIUS = 6;
6060
RESOURCE_SHIELD_ICON = 'STYLED_BUTTON_SHIELD_ADMIN';
6161
DEFAULT_MAX_BADGE_VALUE = 99;

source/Vcl.StyledTaskDialog.pas

Lines changed: 30 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,18 @@ TStyledTaskDialog = class(TTaskDialog)
9898
FUseAnimations: Boolean;
9999
FUseMessageDefaultButton: Boolean;
100100
FMessageDefaultButton: TMsgDlgBtn;
101-
FDefineDialogSize: TTaskDialogShow;
101+
FOnDialogShow: TTaskDialogShow;
102102
FHideSystemCloseButton: Boolean;
103103
function IsDefaultFamily: Boolean;
104104
procedure SetAutoClick(const AValue: Boolean);
105105
procedure SetAutoClickDelay(const AValue: Integer);
106106
procedure SetAlphaBlendValue(const AValue: Byte);
107107
procedure SetButtonsHeight(const AValue: Integer);
108108
procedure SetButtonsWidth(const AValue: Integer);
109-
function GetFlags: TTaskDialogFlags;
110-
procedure SetFlags(const AValue: TTaskDialogFlags);
111109
function GetHandle: HWND;
112110
procedure SetHandle(const AValue: HWND);
113111
strict protected
114112
function DoExecute(ParentWnd: HWND): Boolean; override;
115-
procedure DoOnDialogCreated; override;
116113
procedure DoOnHelp; override;
117114
protected
118115
public
@@ -122,13 +119,14 @@ TStyledTaskDialog = class(TTaskDialog)
122119
constructor Create(AOwner: TComponent); override;
123120
function Execute(ParentWnd: HWND): Boolean; overload; override;
124121
function FindDialogButton(const AModalResult: TModalResult): TStyledButton;
122+
function IsCustomPosition: Boolean;
125123
property MessageDefaultButton: TMsgDlgBtn read FMessageDefaultButton;
126124
property UseMessageDefaultButton: Boolean read FUseMessageDefaultButton;
127125
property HelpFile: string read FHelpFile write FHelpFile;
128-
property Position: TPoint read FPosition write FPosition;
129-
property MainIconSize: Integer read FMainIconSize write FMainIconSize default DEFAULT_MAIN_ICON_SIZE;
126+
property Handle: HWND read GetHandle write SetHandle;
130127
property OnFindDialogButton: TOnFindDialogButtonEvent read FOnFindDialogButton write FOnFindDialogButton;
131128
published
129+
//Additional properties compared to TTaskDialog
132130
property AutoClick: Boolean read FAutoClick write SetAutoClick default False;
133131
property AutoClickDelay: Integer read FAutoClickDelay write SetAutoClickDelay default DEFAULT_AUTOCLICK_DELAY;
134132
property DialogButtonsFamily: TStyledButtonFamily read FDialogButtonsFamily write FDialogButtonsFamily stored IsDefaultFamily;
@@ -138,10 +136,10 @@ TStyledTaskDialog = class(TTaskDialog)
138136
property AlphaBlendValue: Byte read FAlphaBlendValue write SetAlphaBlendValue default DEFAULT_STYLEDDIALOG_ALPHABLEND;
139137
property ButtonsWidth: Integer read FButtonsWidth write SetButtonsWidth default DEFAULT_STYLEDDIALOG_BUTTONSWIDTH;
140138
property ButtonsHeight: Integer read FButtonsHeight write SetButtonsHeight default DEFAULT_STYLEDDIALOG_BUTTONSHEIGHT;
141-
property Flags: TTaskDialogFlags read GetFlags write SetFlags default [tfAllowDialogCancellation, tfPositionRelativeToWindow];
142139
property HideSystemCloseButton: Boolean read FHideSystemCloseButton write FHideSystemCloseButton default False;
143-
property Handle: HWND read GetHandle write SetHandle;
144-
property OnDialogShow: TTaskDialogShow read FDefineDialogSize write FDefineDialogSize;
140+
property Position: TPoint read FPosition write FPosition stored IsCustomPosition;
141+
property MainIconSize: Integer read FMainIconSize write FMainIconSize default DEFAULT_MAIN_ICON_SIZE;
142+
property OnDialogShow: TTaskDialogShow read FOnDialogShow write FOnDialogShow;
145143
end;
146144

147145
//Abstraction of a Dialog Launcher
@@ -354,8 +352,9 @@ function InternalDoTaskMessageDlgPosHelp(const Instruction, Msg: string;
354352
Application.ModalStarted;
355353
LTaskDialog := TStyledTaskDialog.Create(nil);
356354
try
355+
//Assign custom position to Dialog
356+
LTaskDialog.Position := TPoint.Create(X, Y);
357357
//Reset default CommonButtons
358-
LTaskDialog.Flags := LTaskDialog.Flags + [tfPositionRelativeToWindow];
359358
LTaskDialog.CommonButtons := [];
360359
//To inform the Dialog Form to use the Default Button specified in MessageDlg
361360
LTaskDialog.FUseMessageDefaultButton := True;
@@ -787,7 +786,8 @@ procedure StyledShowMessageFmt(const Msg: string; Params: array of const); overl
787786
constructor TStyledTaskDialog.Create(AOwner: TComponent);
788787
begin
789788
inherited;
790-
Flags := [tfAllowDialogCancellation, tfPositionRelativeToWindow];
789+
//Default Position: -1, -1 (is not a custom position)
790+
FPosition := TPoint.Create(-1,-1);
791791
FDialogButtonsFamily := _DialogButtonsFamily;
792792
FUseCommandLinks := _UseCommandLinks;
793793
FUseTitleInMessageDlg := _UseTitleInMessageDlg;
@@ -816,31 +816,6 @@ function TStyledTaskDialog.DoExecute(ParentWnd: HWND): Boolean;
816816
Result := inherited DoExecute(ParentWnd);
817817
end;
818818

819-
procedure TStyledTaskDialog.DoOnDialogCreated;
820-
var
821-
Rect: TRect;
822-
LX, LY: Integer;
823-
LHandle: HMONITOR;
824-
LMonitorInfo: TMonitorInfo;
825-
begin
826-
LX := Position.X;
827-
LY := Position.Y;
828-
LHandle := MonitorFromWindow(FParentWnd, MONITOR_DEFAULTTONEAREST);
829-
LMonitorInfo.cbSize := SizeOf(LMonitorInfo);
830-
if GetMonitorInfo(LHandle, {$IFNDEF CLR}@{$ENDIF}LMonitorInfo) then
831-
with LMonitorInfo do
832-
begin
833-
GetWindowRect(Handle, Rect);
834-
if LX < 0 then
835-
LX := ((rcWork.Right - rcWork.Left) - (Rect.Right - Rect.Left)) div 2;
836-
if LY < 0 then
837-
LY := ((rcWork.Bottom - rcWork.Top) - (Rect.Bottom - Rect.Top)) div 2;
838-
Inc(LX, rcWork.Left);
839-
Inc(LY, rcWork.Top);
840-
SetWindowPos(Handle, 0, LX, LY, 0, 0, SWP_NOACTIVATE or SWP_NOSIZE or SWP_NOZORDER);
841-
end;
842-
end;
843-
844819
procedure TStyledTaskDialog.DoOnExpandButtonClicked(Expanded: Boolean);
845820
begin
846821
inherited DoOnExpandButtonClicked(not Expanded);
@@ -892,14 +867,14 @@ function TStyledTaskDialog.FindDialogButton(
892867
Result := nil;
893868
end;
894869

895-
function TStyledTaskDialog.GetFlags: TTaskDialogFlags;
870+
function TStyledTaskDialog.GetHandle: HWND;
896871
begin
897-
Result := inherited Flags;
872+
Result := inherited Handle;
898873
end;
899874

900-
function TStyledTaskDialog.GetHandle: HWND;
875+
function TStyledTaskDialog.IsCustomPosition: Boolean;
901876
begin
902-
Result := inherited Handle;
877+
Result := (FPosition.X <> -1) and (FPosition.Y <> -1);
903878
end;
904879

905880
function TStyledTaskDialog.IsDefaultFamily: Boolean;
@@ -936,29 +911,24 @@ procedure TStyledTaskDialog.SetButtonsWidth(const AValue: Integer);
936911
FButtonsWidth := AValue;
937912
end;
938913

939-
procedure TStyledTaskDialog.SetFlags(const AValue: TTaskDialogFlags);
914+
procedure TStyledTaskDialog.SetHandle(const AValue: HWND);
915+
var
916+
Context: TRttiContext;
917+
RttiType: TRttiType;
918+
Field: TRttiField;
940919
begin
941-
inherited Flags := AValue;
920+
Context := TRttiContext.Create;
921+
try
922+
RttiType := Context.GetType(Self.ClassType);
923+
Field := RttiType.GetField('FHandle');
924+
if Assigned(Field) then
925+
Field.SetValue(Self, AValue);
926+
finally
927+
Context.Free;
928+
end;
942929
end;
943930

944-
procedure TStyledTaskDialog.SetHandle(const AValue: HWND);
945-
var
946-
Context: TRttiContext;
947-
RttiType: TRttiType;
948-
Field: TRttiField;
949-
begin
950-
Context := TRttiContext.Create;
951-
try
952-
RttiType := Context.GetType(Self.ClassType);
953-
Field := RttiType.GetField('FHandle');
954-
if Assigned(Field) then
955-
Field.SetValue(Self, AValue);
956-
finally
957-
Context.Free;
958-
end;
959-
end;
960-
961-
function GetDialogTypeTitle(const DlgType: TMsgDlgType): string;
931+
function GetDialogTypeTitle(const DlgType: TMsgDlgType): string;
962932
begin
963933
case DlgType of
964934
mtWarning : Result := STR_WARNING;

0 commit comments

Comments
 (0)