Skip to content

Commit fea5b95

Browse files
ver 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 DefaultButton for StyledDialog using MessageDlg and TaskDialog
1 parent 783c099 commit fea5b95

10 files changed

+1971
-1867
lines changed

Demos/source/StyledDialogDemoForm.dfm

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
7676
end
7777
object btUseStyledDialogComp: TButton
7878
Left = 521
79-
Top = 127
79+
Top = 160
8080
Width = 195
8181
Height = 25
8282
Anchors = [akTop, akRight]
@@ -86,7 +86,7 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
8686
end
8787
object btUseNativeDialogComp: TButton
8888
Left = 521
89-
Top = 158
89+
Top = 191
9090
Width = 195
9191
Height = 25
9292
Anchors = [akTop, akRight]
@@ -109,8 +109,8 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
109109
object VerificationTextMemo: TMemo
110110
Left = 112
111111
Top = 168
112-
Width = 387
113-
Height = 56
112+
Width = 384
113+
Height = 48
114114
Anchors = [akLeft, akTop, akRight]
115115
Lines.Strings = (
116116
'Verification Text'
@@ -120,18 +120,19 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
120120
end
121121
object rgMainIcon: TRadioGroup
122122
Left = 521
123-
Top = 13
123+
Top = 10
124124
Width = 195
125-
Height = 107
125+
Height = 142
126126
Anchors = [akTop, akRight]
127127
Caption = 'Main Icon'
128-
ItemIndex = 0
128+
ItemIndex = 3
129129
Items.Strings = (
130130
'tdiNone'
131131
'tdiWarning'
132132
'tdiError'
133133
'tdiInformation'
134-
'tdiShield')
134+
'tdiShield'
135+
'tdiQuestion')
135136
TabOrder = 4
136137
end
137138
object CaptionEdit: TEdit
@@ -342,7 +343,7 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
342343
object cbUseCommandLinks: TCheckBox
343344
Left = 339
344345
Top = 210
345-
Width = 153
346+
Width = 170
346347
Height = 17
347348
Anchors = [akLeft, akBottom]
348349
Caption = 'Use Command Links'
@@ -352,12 +353,10 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
352353
object cbUseTitleInMessageDlg: TCheckBox
353354
Left = 339
354355
Top = 245
355-
Width = 153
356+
Width = 170
356357
Height = 17
357358
Anchors = [akLeft, akBottom]
358359
Caption = 'Add Title in MessageDlg'
359-
Checked = True
360-
State = cbChecked
361360
TabOrder = 11
362361
OnClick = InitializeDialogsClick
363362
end
@@ -369,7 +368,7 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
369368
Anchors = [akLeft, akBottom]
370369
Caption = 'Native ShowMessage'
371370
TabOrder = 12
372-
OnClick = DoShowMessage
371+
OnClick = ShowDlg
373372
end
374373
object btStyledShowMessage: TButton
375374
Left = 173
@@ -379,7 +378,7 @@ object fmStyledTaskDialog: TfmStyledTaskDialog
379378
Anchors = [akLeft, akBottom]
380379
Caption = 'Styled ShowMessage'
381380
TabOrder = 13
382-
OnClick = DoShowMessage
381+
OnClick = ShowDlg
383382
end
384383
object ButtonsWidthSpinEdit: TSpinEdit
385384
Left = 299

Demos/source/StyledDialogDemoForm.pas

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ TfmStyledTaskDialog = class(TForm)
102102
procedure TaskDialogRadioButtonClicked(Sender: TObject);
103103
procedure TaskDialogVerificationClicked(Sender: TObject);
104104
procedure InitializeDialogsClick(Sender: TObject);
105-
procedure DoShowMessage(Sender: TObject);
106105
private
107106
FRadioButtonSelected: string;
108107
procedure ShowSelection(const AModalResult: TModalResult);
@@ -138,14 +137,6 @@ procedure TfmStyledTaskDialog.InitializeDialogsClick(Sender: TObject);
138137
InitializeDialogs;
139138
end;
140139

141-
procedure TfmStyledTaskDialog.DoShowMessage(Sender: TObject);
142-
begin
143-
if Sender = btNativeShowMessage then
144-
ShowMessage(edMessage.Text)
145-
else
146-
StyledShowMessage(edMessage.Text);
147-
end;
148-
149140
procedure TfmStyledTaskDialog.InitializeDialogs;
150141
var
151142
LAutoClickDelay: Integer;
@@ -261,7 +252,13 @@ procedure TfmStyledTaskDialog.ShowDlg(Sender: TObject);
261252

262253
if LUseDefaultbutton then
263254
begin
264-
if Sender = btNativeTaskDialog then
255+
if Sender = btNativeShowMessage then
256+
//Call Delphi MessageDlg
257+
LResult := MessageDlg(edMessage.Text, LDlgType, LButtons, HelpContext, LDefaultButton)
258+
else if Sender = btStyledShowMessage then
259+
//Call Styled MessageDlg
260+
LResult := StyledMessageDlg(edMessage.Text, LDlgType, LButtons, HelpContext, LDefaultButton)
261+
else if Sender = btNativeTaskDialog then
265262
//Call Delphi TaskMessageDlg passing Default Button
266263
LResult := TaskMessageDlg(edTitle.Text, edMessage.Text, LDlgType, LButtons, HelpContext, LDefaultButton)
267264
else if Sender = btNativeMsgDialog then
@@ -278,7 +275,13 @@ procedure TfmStyledTaskDialog.ShowDlg(Sender: TObject);
278275
end
279276
else
280277
begin
281-
if Sender = btNativeTaskDialog then
278+
if Sender = btNativeShowMessage then
279+
//Call Delphi MessageDlg without Default Button
280+
LResult := MessageDlg(edMessage.Text, LDlgType, LButtons, HelpContext)
281+
else if Sender = btStyledShowMessage then
282+
//Call Styled MessageDlg without Default Button
283+
LResult := StyledMessageDlg(edMessage.Text, LDlgType, LButtons, HelpContext)
284+
else if Sender = btNativeTaskDialog then
282285
//Call Delphi TaskMessageDlg without Default Button
283286
LResult := TaskMessageDlg(edTitle.Text, edMessage.Text, LDlgType, LButtons, HelpContext)
284287
else if Sender = btNativeMsgDialog then
@@ -395,6 +398,9 @@ procedure TfmStyledTaskDialog.UseStyleDialogCompClick(Sender: TObject);
395398
StyledTaskDialog.AutoClickDelay := AutoClickDelaySpinEdit.Value;
396399
StyledTaskDialog.ButtonsWidth := ButtonsWidthSpinEdit.Value;
397400
StyledTaskDialog.Flags := StyledTaskDialog.Flags - [tfVerificationFlagChecked];
401+
{$IFDEF SKIA}
402+
StyledTaskDialog.UseAnimations := True;
403+
{$ENDIF}
398404
end
399405
else
400406
begin

README.htm

Lines changed: 7 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.3</h3>
34+
<h3>Actual official version: 3.7.4</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,6 +347,12 @@ <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>10 Nov 2024: version 3.7.4</p>
351+
<ul>
352+
<li>Added tdiQuestion value to show a Question mark in TaskDialog</li>
353+
<li>Use Question Mark (icon ora animation) for MessageDlg and TaskDialog of mtConfirmation type</li>
354+
<li>Fixed DefaultButton for StyledDialog using MessageDlg and TaskDialog</li>
355+
</ul>
350356
<p>08 Nov 2024: version 3.7.3</p>
351357
<ul>
352358
<li>Fixed Animated TaskDialog Form</li>

README.md

Lines changed: 6 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.3
5+
### Actual official version: 3.7.4
66

77
---
88
## A brief description
@@ -403,6 +403,11 @@ 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+
10 Nov 2024: version 3.7.4
407+
- Added tdiQuestion value to show a Question mark in TaskDialog
408+
- Use Question Mark (icon ora animation) for MessageDlg and TaskDialog of mtConfirmation type
409+
- Fixed DefaultButton for StyledDialog using MessageDlg and TaskDialog
410+
406411
08 Nov 2024: version 3.7.3
407412
- Fixed Animated TaskDialog Form
408413

packages/Vcl.StyledComponentsRegister.pas

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ TStyledTaskDialogComponentEditor = class(TComponentEditor)
126126
procedure ExecuteVerb(Index: Integer); override;
127127
end;
128128

129+
TStyledTaskDialogIconPropertyEditor = class(TIntegerProperty)
130+
private
131+
function ValueToString(const AValue: Integer): string;
132+
function StringToValue(const AValue: string): Integer;
133+
public
134+
function GetAttributes: TPropertyAttributes; override;
135+
function GetValue: string; override;
136+
procedure GetValues(Proc: TGetStrProc); override;
137+
procedure SetValue(const Value: string); override;
138+
end;
139+
129140
TStyledComponentSelection = class (TSelectionEditor, ISelectionEditor)
130141
public
131142
procedure RequiresUnits(Proc: TGetStrProc); override;
@@ -168,6 +179,7 @@ implementation
168179
uses
169180
System.SysUtils
170181
, ToolsAPI
182+
, Vcl.Dialogs
171183
, Vcl.StandardButtonStyles
172184
, Vcl.BootstrapButtonStyles
173185
, Vcl.AngularButtonStyles
@@ -441,6 +453,7 @@ function TStyledButtonComponentEditor.GetVerbCount: Integer;
441453
end;
442454

443455
{ TStyledComponentSelection }
456+
444457
procedure TStyledComponentSelection.RequiresUnits(Proc: TGetStrProc);
445458
begin
446459
inherited RequiresUnits(Proc);
@@ -783,6 +796,63 @@ function TStyledTaskDialogComponentEditor.GetVerbCount: Integer;
783796
Result := 2;
784797
end;
785798

799+
{ TStyledTaskDialogIconPropertyEditor }
800+
801+
function TStyledTaskDialogIconPropertyEditor.GetAttributes: TPropertyAttributes;
802+
begin
803+
Result := [paValueList, paMultiSelect];
804+
end;
805+
806+
function TStyledTaskDialogIconPropertyEditor.ValueToString(
807+
const AValue: Integer): string;
808+
begin
809+
case AValue of
810+
tdiNone: Result := 'tdiNone';
811+
tdiWarning: Result := 'tdiWarning';
812+
tdiError: Result := 'Error';
813+
tdiInformation: Result := 'tdiInformation';
814+
tdiShield: Result := 'tdiShield';
815+
tdiQuestion: Result := 'tdiQuestion';
816+
else
817+
Result := IntToStr(AValue);
818+
end;
819+
end;
820+
821+
function TStyledTaskDialogIconPropertyEditor.StringToValue(
822+
const AValue: string): Integer;
823+
begin
824+
if SameText(AValue, 'tdiNone') then Result := tdiNone
825+
else if SameText(AValue, 'tdiWarning') then Result := tdiWarning
826+
else if SameText(AValue, 'tdiError') then Result := tdiError
827+
else if SameText(AValue, 'tdiInformation') then Result := tdiInformation
828+
else if SameText(AValue, 'tdiShield') then Result := tdiShield
829+
else if SameText(AValue, 'tdiQuestion') then Result := tdiQuestion
830+
else
831+
TryStrToInt(AValue, Result);
832+
end;
833+
834+
function TStyledTaskDialogIconPropertyEditor.GetValue: string;
835+
var
836+
I: Integer;
837+
begin
838+
I := GetOrdValue;
839+
Result := ValueToString(I);
840+
end;
841+
842+
procedure TStyledTaskDialogIconPropertyEditor.GetValues(Proc: TGetStrProc);
843+
var
844+
I: Integer;
845+
begin
846+
inherited;
847+
for I := tdiNone to tdiQuestion do
848+
Proc(ValueToString(I));
849+
end;
850+
851+
procedure TStyledTaskDialogIconPropertyEditor.SetValue(const Value: string);
852+
begin
853+
SetOrdValue(StringToValue(Value));
854+
end;
855+
786856
{ TImageIndexPropertyEditor }
787857

788858
function TImageIndexPropertyEditor.GetImageListAt(Index: Integer): TCustomImageList;
@@ -1036,6 +1106,12 @@ procedure Register;
10361106
RegisterPropertyEditor(TypeInfo(TStyledButtonAppearance),
10371107
TStyledButtonItem, 'StyleAppearance', TStyledAppearancePropertyEditor);
10381108

1109+
//Property Editor for Icon Value of StyledTaskDialog
1110+
RegisterPropertyEditor(TypeInfo(TTaskDialogIcon),
1111+
TStyledTaskDialog, 'MainIcon', TStyledTaskDialogIconPropertyEditor);
1112+
RegisterPropertyEditor(TypeInfo(TTaskDialogIcon),
1113+
TStyledTaskDialog, 'FooterIcon', TStyledTaskDialogIconPropertyEditor);
1114+
10391115
//Property Editor for ImageIndex
10401116
RegisterPropertyEditor(TypeInfo(System.UITypes.TImageIndex),
10411117
TStyledGraphicButton, 'ImageIndex', TImageIndexPropertyEditor);

source/Skia.Vcl.StyledTaskDialogAnimatedUnit.pas

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ TStyledTaskDialogAnimatedForm = class(TStyledTaskDialogForm)
6363
private
6464
procedure InternalLoadImage(const AAnimatedImage: TSkAnimatedImage;
6565
const AImageIndex: TImageIndex; AImageName: string);
66-
function TaskDialogIconToIconName(
67-
const ATaskDialogIcon: TTaskDialogIcon): string;
6866
protected
6967
class function CanUseAnimations: Boolean; override;
7068
procedure LoadImage(const AImageIndex: TImageIndex; AImageName: string); override;
@@ -87,27 +85,14 @@ class function TStyledTaskDialogAnimatedForm.CanUseAnimations: Boolean;
8785
Result := True;
8886
end;
8987

90-
function TStyledTaskDialogAnimatedForm.TaskDialogIconToIconName(
91-
const ATaskDialogIcon: TTaskDialogIcon): string;
92-
begin
93-
case ATaskDialogIcon of
94-
tdiWarning: Result := 'Warning';
95-
tdiError: Result := 'Error';
96-
tdiInformation: Result := 'Information';
97-
tdiShield: Result := 'Shield';
98-
else
99-
Result := 'Custom';
100-
end;
101-
end;
102-
10388
procedure TStyledTaskDialogAnimatedForm.LoadCustomFooterIcon(const AIcon: TIcon;
10489
const ATaskDialogIcon: TTaskDialogIcon);
10590
var
10691
LImageName: string;
10792
begin
10893
inherited;
10994
//A Custom FooterIcon is not animated so ignore It
110-
LImageName := TaskDialogIconToIconName(ATaskDialogIcon);
95+
LImageName := TaskDialogIconToImageName(ATaskDialogIcon);
11196
if LImageName <> '' then
11297
InternalLoadImage(SkFooterAnimatedImage, -1, LImageName);
11398
end;
@@ -118,9 +103,9 @@ procedure TStyledTaskDialogAnimatedForm.LoadCustomMainIcon(const AIcon: TIcon;
118103
LImageName: string;
119104
begin
120105
//A Custom MainIcon is not animated so ignore it
121-
LImageName := TaskDialogIconToIconName(ATaskDialogIcon);
106+
LImageName := TaskDialogIconToImageName(ATaskDialogIcon);
122107
if LImageName <> '' then
123-
InternalLoadImage(SkAnimatedImage, -1, LImageName);
108+
InternalLoadImage(SkAnimatedImage, ATaskDialogIcon, LImageName);
124109
end;
125110

126111
procedure TStyledTaskDialogAnimatedForm.LoadImage(
@@ -136,6 +121,8 @@ procedure TStyledTaskDialogAnimatedForm.InternalLoadImage(
136121
LStream: TResourceStream;
137122
LImageName: string;
138123
begin
124+
if AImageName = '' then
125+
Exit;
139126
//Using ..\Animations\Animations.rc file compiled into Animations.RES file
140127
LImageName := UpperCase('LOTTIE_'+AImageName);
141128
LStream := TResourceStream.Create(HInstance, LImageName, RT_RCDATA);

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

0 commit comments

Comments
 (0)