• R/O
  • SSH
  • HTTPS

akdf: Commit


Commit MetaInfo

Revision583 (tree)
Time2022-07-04 10:32:03
Authorderekwildstar

Log Message

Toda a codificação do componente TKRKTaskDialog foi concluída, mas ainda não foram feitos seus editores de propriedades ou de componente. O componente ainda não é instalável
A compatibilização com o Delphi 2006 foi concluída com sucesso!

Change Summary

Incremental Difference

--- trunk/rtp/src/Rtl/Win/KRK.Rtl.Win.CommCtrl.pas (revision 582)
+++ trunk/rtp/src/Rtl/Win/KRK.Rtl.Win.CommCtrl.pas (revision 583)
@@ -456,8 +456,10 @@
456456 end;
457457
458458 {$IF RTLVersion = 18} { Delphi 2006 }
459-//{$ALIGN 1} não sei se isso é necessário, acho que não é
460459 type
460+ PFTASKDIALOGCALLBACK = function(hwnd: HWND; msg: UINT; wParam: WPARAM; lParam: LPARAM; lpRefData: LONG_PTR): HResult; stdcall;
461+ TFTaskDialogCallback = PFTASKDIALOGCALLBACK;
462+{$ALIGN 1}
461463 TASKDIALOG_BUTTON = record
462464 nButtonID: Integer;
463465 pszButtonText: LPCWSTR;
@@ -464,6 +466,45 @@
464466 end;
465467 PTaskDialogButton = ^TTaskDialogButton;
466468 TTaskDialogButton = TASKDIALOG_BUTTON;
469+
470+ TASKDIALOGCONFIG = record
471+ cbSize: UINT;
472+ hwndParent: HWND; // incorrectly named, this is the owner window, not a parent.
473+ hInstance: HINST; // used for MAKEINTRESOURCE() strings
474+ dwFlags: DWORD; // TASKDIALOG_FLAGS (TDF_XXX) flags
475+ dwCommonButtons: DWORD; // TASKDIALOG_COMMON_BUTTON (TDCBF_XXX) flags
476+ pszWindowTitle: LPCWSTR; // string or MAKEINTRESOURCE()
477+ case Integer of
478+ 0: (hMainIcon: HICON);
479+ 1: (pszMainIcon: LPCWSTR;
480+ pszMainInstruction: LPCWSTR;
481+ pszContent: LPCWSTR;
482+ cButtons: UINT;
483+ pButtons: PTaskDialogButton;
484+ nDefaultButton: Integer;
485+ cRadioButtons: UINT;
486+ pRadioButtons: PTaskDialogButton;
487+ nDefaultRadioButton: Integer;
488+ pszVerificationText: LPCWSTR;
489+ pszExpandedInformation: LPCWSTR;
490+ pszExpandedControlText: LPCWSTR;
491+ pszCollapsedControlText: LPCWSTR;
492+ case Integer of
493+ 0: (hFooterIcon: HICON);
494+ 1: (pszFooterIcon: LPCWSTR;
495+ pszFooter: LPCWSTR;
496+ pfCallback: TFTaskDialogCallback;
497+ lpCallbackData: LONG_PTR;
498+ cxWidth: UINT // width of the Task Dialog's client area in DLU's.
499+ // If 0, Task Dialog will calculate the ideal width.
500+ );
501+ );
502+ end;
503+ PTaskDialogConfig = ^TTaskDialogConfig;
504+ TTaskDialogConfig = TASKDIALOGCONFIG;
505+{$ALIGN ON}
506+
507+function TaskDialogIndirect(const ATaskConfig: TTaskDialogConfig; AButton: PInteger; ARadioButton: PInteger; AVerificationFlagChecked: PBOOL): HRESULT;
467508 {$IFEND}
468509
469510 const
@@ -473,6 +514,26 @@
473514 PBST_ERROR = 2;
474515 PBST_PAUSED = 3;
475516
517+ { Task Dialog Flags }
518+ TDF_ENABLE_HYPERLINKS = $0001;
519+ TDF_USE_HICON_MAIN = $0002;
520+ TDF_USE_HICON_FOOTER = $0004;
521+ TDF_ALLOW_DIALOG_CANCELLATION = $0008;
522+ TDF_USE_COMMAND_LINKS = $0010;
523+ TDF_USE_COMMAND_LINKS_NO_ICON = $0020;
524+ TDF_EXPAND_FOOTER_AREA = $0040;
525+ TDF_EXPANDED_BY_DEFAULT = $0080;
526+ TDF_VERIFICATION_FLAG_CHECKED = $0100;
527+ TDF_SHOW_PROGRESS_BAR = $0200;
528+ TDF_SHOW_MARQUEE_PROGRESS_BAR = $0400;
529+ TDF_CALLBACK_TIMER = $0800;
530+ TDF_POSITION_RELATIVE_TO_WINDOW = $1000;
531+ TDF_RTL_LAYOUT = $2000;
532+ TDF_NO_DEFAULT_RADIO_BUTTON = $4000;
533+ TDF_CAN_BE_MINIMIZED = $8000;
534+ TDF_NO_SET_FOREGROUND = $00010000; // Don't call SetForegroundWindow() when activating the dialog - WIN8
535+ TDF_SIZE_TO_CONTENT = $01000000; // used by ShellMessageBox to emulate MessageBox sizing behavior
536+
476537 { Task Dialog Messages }
477538 TDM_CLICK_BUTTON = WM_USER+102; // wParam = Button ID
478539 TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER + 103; // wParam = 0 (nonMarque) wParam != 0 (Marquee)
@@ -484,9 +545,56 @@
484545 TDM_ENABLE_BUTTON = WM_USER + 111; // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID
485546 TDM_ENABLE_RADIO_BUTTON = WM_USER + 112; // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID
486547 TDM_CLICK_VERIFICATION = WM_USER + 113; // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus)
548+ TDM_UPDATE_ELEMENT_TEXT = WM_USER + 114; // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
487549 TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER + 115; // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required)
550+ TDM_UPDATE_ICON = WM_USER + 116; // wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise)
488551
552+ { Task Dialog Notifications }
553+ TDN_CREATED = 0;
554+ TDN_NAVIGATED = 1;
555+ TDN_BUTTON_CLICKED = 2; // wParam = Button ID
556+ TDN_HYPERLINK_CLICKED = 3;
557+ TDN_TIMER = 4; // wParam = Milliseconds since dialog created or timer reset
558+ TDN_DESTROYED = 5;
559+ TDN_RADIO_BUTTON_CLICKED = 6;
560+ TDN_DIALOG_CONSTRUCTED = 7;
561+ TDN_VERIFICATION_CLICKED = 8; // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0
562+ TDN_HELP = 9;
563+ TDN_EXPANDO_BUTTON_CLICKED = 10; // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded)
489564
565+
566+ { Task Dialog Elements }
567+ TDE_CONTENT = 0;
568+ TDE_EXPANDED_INFORMATION = 1;
569+ TDE_FOOTER = 2;
570+ TDE_MAIN_INSTRUCTION = 3;
571+
572+ { Task Dialog Icon Elements }
573+ TDIE_ICON_MAIN = 0;
574+ TDIE_ICON_FOOTER = 1;
575+
576+ { Task Dialog Common Icons }
577+ TD_WARNING_ICON = MAKEINTRESOURCEW(Word(-1)); // 65535
578+ TD_ERROR_ICON = MAKEINTRESOURCEW(Word(-2)); // 65534
579+ TD_INFORMATION_ICON = MAKEINTRESOURCEW(Word(-3)); // 65533
580+ TD_SHIELD_ICON = MAKEINTRESOURCEW(Word(-4)); // 65532
581+{$IFEND}
582+ TD_SHIELD_ICON_HEAD_BLUE = MAKEINTRESOURCEW(Word(-5)); // 65531;
583+ TD_SHIELD_ICON_HEAD_WARNING = MAKEINTRESOURCEW(Word(-6)); // 65530
584+ TD_SHIELD_ICON_HEAD_ERROR = MAKEINTRESOURCEW(Word(-7)); // 65529
585+ TD_SHIELD_ICON_HEAD_OK = MAKEINTRESOURCEW(Word(-8)); // 65528
586+ TD_SHIELD_ICON_HEAD_GREEN = MAKEINTRESOURCEW(Word(-9)); // 65527
587+{$IF RTLVersion = 18} { Delphi 2006 }
588+
589+ { Task Dialog Button Flags }
590+ TDCBF_OK_BUTTON = $0001; // selected control return value IDOK
591+ TDCBF_YES_BUTTON = $0002; // selected control return value IDYES
592+ TDCBF_NO_BUTTON = $0004; // selected control return value IDNO
593+ TDCBF_CANCEL_BUTTON = $0008; // selected control return value IDCANCEL
594+ TDCBF_RETRY_BUTTON = $0010; // selected control return value IDRETRY
595+ TDCBF_CLOSE_BUTTON = $0020; // selected control return value IDCLOSE
596+
597+ { Tooltips }
490598 TOOLTIPS_CLASS = 'tooltips_class32';
491599 MAX_LINKID_TEXT = 48;
492600 L_MAX_URL_LENGTH = 2048 + 32 + length('://') + 1;
@@ -577,7 +685,20 @@
577685 {$IF CompilerVersion >= 19}UITypes,{$IFEND} { Delphi 2007 } SysUtils, Forms,
578686 Types, KRK.Rtl.Sys.System.SysUtils;
579687
688+
689+
690+{$IF CompilerVersion = 18} { Delphi 2006 }
580691 const
692+{$IFDEF MSWINDOWS}
693+ cctrl = comctl32;
694+{$ENDIF}
695+
696+var
697+ ComCtl32DLL: THandle;
698+ _InitCommonControlsEx: function(var AICC: TInitCommonControlsEx): Bool stdcall;
699+{$IFEND}
700+
701+const
581702 // Tamanho máximo do texto do ToolTip, em caracteres. O texto do ToolTip pode
582703 // ter qualquer tamanho, entretanto eu impus esta limitação para facilitar a
583704 // manipulação deste texto, pois limitar desta forma facilita na criação de
@@ -1691,4 +1812,38 @@
16911812 end;
16921813 end;
16931814
1815+{$IF CompilerVersion = 18}
1816+procedure InitComCtl;
1817+begin
1818+ if ComCtl32DLL = 0 then
1819+ begin
1820+ ComCtl32DLL := GetModuleHandle(cctrl);
1821+
1822+ if ComCtl32DLL <> 0 then
1823+ @_InitCommonControlsEx := GetProcAddress(ComCtl32DLL, 'InitCommonControlsEx');
1824+ end;
1825+end;
1826+
1827+var
1828+ _TaskDialogIndirect: function(const ATaskConfig: TTaskDialogConfig; AButton: PInteger; ARadioButton: PInteger; AVerificationFlagChecked: PBOOL): HRESULT; stdcall;
1829+
1830+function TaskDialogIndirect(const ATaskConfig: TTaskDialogConfig; AButton: PInteger; ARadioButton: PInteger; AVerificationFlagChecked: PBOOL): HRESULT;
1831+begin
1832+ if Assigned(_TaskDialogIndirect) then
1833+ Result := _TaskDialogIndirect(ATaskConfig, AButton, ARadioButton, AVerificationFlagChecked)
1834+ else
1835+ begin
1836+ InitComCtl;
1837+ Result := E_NOTIMPL;
1838+
1839+ if ComCtl32DLL <> 0 then
1840+ begin
1841+ @_TaskDialogIndirect := GetProcAddress(ComCtl32DLL, 'TaskDialogIndirect');
1842+ if Assigned(_TaskDialogIndirect) then
1843+ Result := _TaskDialogIndirect(ATaskConfig, AButton, ARadioButton, AVerificationFlagChecked);
1844+ end;
1845+ end;
1846+end;
1847+{$IFEND}
1848+
16941849 end.
--- trunk/rtp/src/Rtl/Win/KRK.Rtl.Win.Messages.pas (revision 582)
+++ trunk/rtp/src/Rtl/Win/KRK.Rtl.Win.Messages.pas (revision 583)
@@ -163,8 +163,9 @@
163163 *)
164164
165165 function SendData(aHandle: THandle; aCopyDataStruct: TCopyDataStruct): Boolean;
166-{$IF RTLVersion <= 18}
166+{$IF RTLVersion = 18}
167167 function SendStructMessage(Handle: HWND; Msg: UINT; WParam: WPARAM; const LParam): LRESULT;
168+function SendTextMessage(Handle: HWND; Msg: UINT; WParam: WPARAM; LParam: WideString): LRESULT; overload;
168169 {$IFEND}
169170
170171
@@ -178,11 +179,16 @@
178179 Result := SendMessage(aHandle, WM_COPYDATA, aHandle, Integer(@aCopyDataStruct)) > 0;
179180 end;
180181
181-{$IF RTLVersion <= 18}
182+{$IF RTLVersion = 18}
182183 function SendStructMessage(Handle: HWND; Msg: UINT; WParam: WPARAM; const LParam): LRESULT;
183184 begin
184185 Result := SendMessage(Handle, Msg, WParam, Windows.LPARAM(@LParam));
185186 end;
187+
188+function SendTextMessage(Handle: HWND; Msg: UINT; WParam: WPARAM; LParam: WideString): LRESULT;
189+begin
190+ Result := SendMessage(Handle, Msg, WParam, Windows.LPARAM(PWideChar(LParam)));
191+end;
186192 {$IFEND}
187193
188194 end.
--- trunk/rtp/src/Vcl/KRK.Vcl.Consts.pas (revision 582)
+++ trunk/rtp/src/Vcl/KRK.Vcl.Consts.pas (revision 583)
@@ -7,6 +7,7 @@
77 STaskDlgRadioButtonCaption = 'RadioButton%d';
88 STaskDlgButtonCaption = 'Button%d';
99 SInvalidTaskDlgButtonCaption = 'Caption cannot be empty';
10+ SWindowsVistaRequired = '%s requires Windows Vista or later';
1011 {$IFEND}
1112
1213 implementation
--- trunk/rtp/src/Vcl/KRK.Vcl.Dialogs.pas (revision 582)
+++ trunk/rtp/src/Vcl/KRK.Vcl.Dialogs.pas (revision 583)
@@ -1,10 +1,10 @@
11 unit KRK.Vcl.Dialogs;
2-
2+{$IF CompilerVersion >= 25}{$LEGACYIFEND ON}{$IFEND} { Delphi XE4 }
33 interface
44
55 uses
6- ComCtrls, KRK.Vcl.ComCtrls, Classes, Controls, Windows, CommCtrl,
7- KRK.Rtl.Win.CommCtrl, Graphics, SysUtils;
6+ Dialogs, ComCtrls, KRK.Vcl.ComCtrls, Classes, Controls, Windows,
7+ KRK.Rtl.Win.Windows, CommCtrl, KRK.Rtl.Win.CommCtrl, Graphics, SysUtils;
88
99 { O componente TKRKTaskDialog é um wrapper em volta da função de API
1010 TaskDialogIndirect que permite a criação de caixas de mensagem altamente
@@ -39,6 +39,10 @@
3939 tdiShieldHeadGreen = 9;
4040
4141 type
42+{$IF CompilerVersion = 18}
43+ EPlatformVersionException = class(Exception);
44+{$IFEND}
45+
4246 TCustomKRKTaskDialog = class;
4347
4448 TKRKTaskDialogFlag = (tfEnableHyperlinks, tfUseHiconMain, tfUseHiconFooter,
@@ -64,7 +68,7 @@
6468 // é usado para indicar o ícone padronizado a ser exibido.
6569 TKRKTaskDialogIcon = Low(Integer)..High(Integer);
6670
67- TProgressBarState = {$IF CompilerVersion = 18}KRK.Vcl.ComCtrls{$ELSE}ComCtrls{$IFEND}.TProgressBarState; // for compatibility
71+ TProgressBarState = {$IF CompilerVersion = 18}KRK.Vcl.ComCtrls{$ELSE}ComCtrls{$IFEND}.TProgressBarState; { Delphi 2006 }
6872
6973 TKRKTaskDialogProgressBar = class(TPersistent)
7074 private
@@ -201,18 +205,18 @@
201205 private
202206 FButton: TKRKTaskDialogButtonItem;
203207 FButtons: TKRKTaskDialogButtons;
204- FCaption: string;
208+ FWindowTitle: string;
205209 FCommonButtons: TKRKTaskDialogCommonButtons;
206210 FCustomFooterIcon: TIcon;
207211 FCustomMainIcon: TIcon;
208212 FDefaultButton: TKRKTaskDialogCommonButton;
209- FExpandButtonCaption: string;
210213 FExpandedControlText: String;
214+ FCollapsedControlText: string;
211215 FExpanded: Boolean;
212- FExpandedText: string;
216+ FExpandedInformation: string;
213217 FFlags: TKRKTaskDialogFlags;
214218 FFooterIcon: TKRKTaskDialogIcon;
215- FFooterText: string;
219+ FFooter: string;
216220 FHandle: HWND;
217221 FHelpContext: Integer;
218222 FMainIcon: TKRKTaskDialogIcon;
@@ -220,8 +224,8 @@
220224 FProgressBar: TKRKTaskDialogProgressBar;
221225 FRadioButton: TKRKTaskDialogRadioButtonItem;
222226 FRadioButtons: TKRKTaskDialogButtons;
223- FText: string;
224- FTitle: string;
227+ FContent: string;
228+ FMainInstruction: string;
225229 FURL: string;
226230 FVerificationText: string;
227231 FOnButtonClicked: TKRKTaskDialogClickEvent;
@@ -234,111 +238,115 @@
234238 FOnRadioButtonClicked: TNotifyEvent;
235239 FOnTimer: TKRKTaskDialogTimerEvent;
236240 FOnVerificationClicked: TNotifyEvent;
237-// procedure SetButtons(const Value: TKRKTaskDialogButtons);
238-// procedure SetExpandedText(const Value: string);
239-// procedure SetFooterIcon(const Value: TKRKTaskDialogIcon);
240-// procedure SetFooterText(const Value: string);
241+
242+ procedure SetButtons(const AValue: TKRKTaskDialogButtons);
243+ procedure SetExpandedInformation(const AValue: string);
244+ procedure SetFooterIcon(const AValue: TKRKTaskDialogIcon);
245+ procedure SetFooter(const AValue: string);
241246 procedure SetFlags(const AValue: TKRKTaskDialogFlags);
242-// procedure SetMainIcon(const Value: TKRKTaskDialogIcon);
243-// procedure SetRadioButtons(const Value: TKRKTaskDialogButtons);
244-// procedure SetText(const Value: string);
245-// procedure SetTitle(const Value: string);
246-// procedure SetCustomFooterIcon(const Value: TIcon);
247-// procedure SetCustomMainIcon(const Value: TIcon);
247+ procedure SetMainIcon(const AValue: TKRKTaskDialogIcon);
248+ procedure SetRadioButtons(const AValue: TKRKTaskDialogButtons);
249+ procedure SetContent(const AValue: string);
250+ procedure SetMainInstruction(const AValue: string);
251+ procedure SetCustomFooterIcon(const AValue: TIcon);
252+ procedure SetCustomMainIcon(const AValue: TIcon);
248253 protected
249-// function DoExecute(ParentWnd: HWND): Boolean; dynamic;
250-// procedure DoOnButtonClicked(AModalResult: Integer; var CanClose: Boolean); dynamic;
251-// procedure DoOnDialogContructed; dynamic;
252-// procedure DoOnDialogCreated; dynamic;
253-// procedure DoOnDialogDestroyed; dynamic;
254-// procedure DoOnExpandButtonClicked(Expanded: Boolean); dynamic;
255-// procedure DoOnHelp; dynamic;
256-// procedure DoOnHyperlinkClicked(const AURL: string); dynamic;
257-// procedure DoOnNavigated; dynamic;
258-// procedure DoOnRadioButtonClicked(ButtonID: Integer); dynamic;
259-// procedure DoOnTimer(TickCount: Cardinal; var Reset: Boolean); dynamic;
260-// procedure DoOnVerificationClicked(Checked: Boolean); dynamic;
261-// procedure ShowHelpException(E: Exception); dynamic;
262-// function CallbackProc(hwnd: HWND; msg: UINT; wParam: WPARAM; lParam: LPARAM; lpRefData: LONG_PTR): HResult; dynamic;
254+ function DoExecute(AParentWnd: HWND): Boolean; dynamic;
255+ procedure DoOnButtonClicked(AModalResult: Integer; var ACanClose: Boolean); dynamic;
256+ procedure DoOnDialogConstructed; dynamic;
257+ procedure DoOnDialogCreated; dynamic;
258+ procedure DoOnDialogDestroyed; dynamic;
259+ procedure DoOnExpandButtonClicked(AExpanded: Boolean); dynamic;
260+ procedure DoOnHelp; dynamic;
261+ procedure DoOnHyperlinkClicked(const AURL: string); dynamic;
262+ procedure DoOnNavigated; dynamic;
263+ procedure DoOnRadioButtonClicked(AButtonID: Integer); dynamic;
264+ procedure DoOnTimer(ATickCount: Cardinal; var AReset: Boolean); dynamic;
265+ procedure DoOnVerificationClicked(AChecked: Boolean); dynamic;
266+ procedure ShowHelpException(AE: Exception); dynamic;
267+ function CallbackProc(hwnd: HWND; msg: UINT; wParam: WPARAM; lParam: LPARAM; lpRefData: LONG_PTR): HResult; dynamic;
263268 public
264-// constructor Create(AOwner: TComponent); override;
265-// destructor Destroy; override;
266-// function Execute: Boolean; overload; dynamic;
267-// function Execute(ParentWnd: HWND): Boolean; overload; dynamic;
268-// property Button: TKRKTaskDialogButtonItem read FButton write FButton;
269-// property Buttons: TKRKTaskDialogButtons read FButtons write SetButtons;
270-// property Caption: string read FCaption write FCaption;
271-// property CommonButtons: TKRKTaskDialogCommonButtons read FCommonButtons write FCommonButtons default [tcbOk, tcbCancel];
272-// property CustomFooterIcon: TIcon read FCustomFooterIcon write SetCustomFooterIcon;
273-// property CustomMainIcon: TIcon read FCustomMainIcon write SetCustomMainIcon;
274-// property DefaultButton: TKRKTaskDialogCommonButton read FDefaultButton write FDefaultButton default tcbOk;
275-// property ExpandButtonCaption: string read FExpandButtonCaption write FExpandButtonCaption;
276-// property ExpandedControlText: String read FExpandedControlText write FExpandedControlText;
277-// property Expanded: Boolean read FExpanded;
278-// property ExpandedText: string read FExpandedText write SetExpandedText;
269+ constructor Create(AOwner: TComponent); override;
270+ destructor Destroy; override;
271+
272+ function Execute: Boolean; overload; dynamic;
273+ function Execute(AParentWnd: HWND): Boolean; overload; dynamic;
274+
275+ property Button: TKRKTaskDialogButtonItem read FButton write FButton;
276+ property Buttons: TKRKTaskDialogButtons read FButtons write SetButtons;
277+ property WindowTitle: string read FWindowTitle write FWindowTitle;
278+ property CommonButtons: TKRKTaskDialogCommonButtons read FCommonButtons write FCommonButtons default [tcbOk, tcbCancel];
279+ property CustomFooterIcon: TIcon read FCustomFooterIcon write SetCustomFooterIcon;
280+ property CustomMainIcon: TIcon read FCustomMainIcon write SetCustomMainIcon;
281+ property DefaultButton: TKRKTaskDialogCommonButton read FDefaultButton write FDefaultButton default tcbOk;
282+ property ExpandedControlText: String read FExpandedControlText write FExpandedControlText;
283+ property CollapsedControlText: string read FCollapsedControlText write FCollapsedControlText;
284+ property Expanded: Boolean read FExpanded;
285+ property ExpandedInformation: string read FExpandedInformation write SetExpandedInformation;
279286 property Flags: TKRKTaskDialogFlags read FFlags write SetFlags default [tfAllowDialogCancellation];
280-// property FooterIcon: TKRKTaskDialogIcon read FFooterIcon write SetFooterIcon default tdiNone;
281-// property FooterText: string read FFooterText write SetFooterText;
287+ property FooterIcon: TKRKTaskDialogIcon read FFooterIcon write SetFooterIcon default tdiNone;
288+ property Footer: string read FFooter write SetFooter;
282289 property Handle: HWND read FHandle;
283-// property HelpContext: Integer read FHelpContext write FHelpContext default 0;
284-// property MainIcon: TKRKTaskDialogIcon read FMainIcon write SetMainIcon default tdiInformation;
285-// property ModalResult: TModalResult read FModalResult write FModalResult;
286-// property ProgressBar: TKRKTaskDialogProgressBar read FProgressBar write FProgressBar;
287-// property RadioButton: TKRKTaskDialogRadioButtonItem read FRadioButton;
288-// property RadioButtons: TKRKTaskDialogButtons read FRadioButtons write SetRadioButtons;
289-// property Text: string read FText write SetText;
290-// property Title: string read FTitle write SetTitle;
291-// property URL: string read FURL;
292-// property VerificationText: string read FVerificationText write FVerificationText;
293-// property OnButtonClicked: TKRKTaskDialogClickEvent read FOnButtonClicked write FOnButtonClicked;
294-// property OnDialogConstructed: TNotifyEvent read FOnDialogConstructed write FOnDialogConstructed;
295-// property OnDialogCreated: TNotifyEvent read FOnDialogCreated write FOnDialogCreated;
296-// property OnDialogDestroyed: TNotifyEvent read FOnDialogDestroyed write FOnDialogDestroyed;
297-// property OnExpanded: TNotifyEvent read FOnExpanded write FOnExpanded;
298-// property OnHyperlinkClicked: TNotifyEvent read FOnHyperlinkClicked write FOnHyperlinkClicked;
299-// property OnNavigated: TNotifyEvent read FOnNavigated write FOnNavigated;
300-// property OnRadioButtonClicked: TNotifyEvent read FOnRadioButtonClicked write FOnRadioButtonClicked;
301-// property OnTimer: TKRKTaskDialogTimerEvent read FOnTimer write FOnTimer;
302-// property OnVerificationClicked: TNotifyEvent read FOnVerificationClicked write FOnVerificationClicked;
290+ property HelpContext: Integer read FHelpContext write FHelpContext default 0;
291+ property MainIcon: TKRKTaskDialogIcon read FMainIcon write SetMainIcon default tdiInformation;
292+ property ModalResult: TModalResult read FModalResult write FModalResult;
293+ property ProgressBar: TKRKTaskDialogProgressBar read FProgressBar write FProgressBar;
294+ property RadioButton: TKRKTaskDialogRadioButtonItem read FRadioButton;
295+ property RadioButtons: TKRKTaskDialogButtons read FRadioButtons write SetRadioButtons;
296+ property Content: string read FContent write SetContent;
297+ property MainInstruction: string read FMainInstruction write SetMainInstruction;
298+ property URL: string read FURL;
299+ property VerificationText: string read FVerificationText write FVerificationText;
300+ property OnButtonClicked: TKRKTaskDialogClickEvent read FOnButtonClicked write FOnButtonClicked;
301+ property OnDialogConstructed: TNotifyEvent read FOnDialogConstructed write FOnDialogConstructed;
302+ property OnDialogCreated: TNotifyEvent read FOnDialogCreated write FOnDialogCreated;
303+ property OnDialogDestroyed: TNotifyEvent read FOnDialogDestroyed write FOnDialogDestroyed;
304+ property OnExpanded: TNotifyEvent read FOnExpanded write FOnExpanded;
305+ property OnHyperlinkClicked: TNotifyEvent read FOnHyperlinkClicked write FOnHyperlinkClicked;
306+ property OnNavigated: TNotifyEvent read FOnNavigated write FOnNavigated;
307+ property OnRadioButtonClicked: TNotifyEvent read FOnRadioButtonClicked write FOnRadioButtonClicked;
308+ property OnTimer: TKRKTaskDialogTimerEvent read FOnTimer write FOnTimer;
309+ property OnVerificationClicked: TNotifyEvent read FOnVerificationClicked write FOnVerificationClicked;
303310 end;
304311
305312 TKRKTaskDialog = class(TCustomKRKTaskDialog)
306-// published
307-// property Buttons;
308-// property Caption;
309-// property CommonButtons;
310-// property CustomFooterIcon;
311-// property CustomMainIcon;
312-// property DefaultButton;
313-// property ExpandButtonCaption;
314-// property ExpandedControlText;
315-// property ExpandedText;
316-// property Flags;
317-// property FooterIcon;
318-// property FooterText;
319-// property HelpContext;
320-// property MainIcon;
321-// property ProgressBar;
322-// property RadioButtons;
323-// property Text;
324-// property Title;
325-// property VerificationText;
326-// property OnButtonClicked;
327-// property OnDialogConstructed;
328-// property OnDialogCreated;
329-// property OnDialogDestroyed;
330-// property OnExpanded;
331-// property OnHyperlinkClicked;
332-// property OnNavigated;
333-// property OnRadioButtonClicked;
334-// property OnTimer;
335-// property OnVerificationClicked;
313+ published
314+ property Buttons;
315+ property WindowTitle;
316+ property CommonButtons;
317+ property CustomFooterIcon;
318+ property CustomMainIcon;
319+ property DefaultButton;
320+ property ExpandedControlText;
321+ property CollapsedControlText;
322+ property ExpandedInformation;
323+ property Flags;
324+ property FooterIcon;
325+ property Footer;
326+ property HelpContext;
327+ property MainIcon;
328+ property ProgressBar;
329+ property RadioButtons;
330+ property Content;
331+ property MainInstruction;
332+ property VerificationText;
333+ property OnButtonClicked;
334+ property OnDialogConstructed;
335+ property OnDialogCreated;
336+ property OnDialogDestroyed;
337+ property OnExpanded;
338+ property OnHyperlinkClicked;
339+ property OnNavigated;
340+ property OnRadioButtonClicked;
341+ property OnTimer;
342+ property OnVerificationClicked;
336343 end;
337344
338345 implementation
339346
340347 uses
341- Consts, KRK.Vcl.Consts, ActiveX, WideStrUtils;
348+ Consts, KRK.Vcl.Consts, ActiveX, WideStrUtils, Forms, KRK.Vcl.Forms, Messages,
349+ KRK.Rtl.Win.Messages;
342350
343351 { Funções utilitárias }
344352
@@ -448,6 +456,379 @@
448456
449457 { TCustomKRKTaskDialog }
450458
459+function TCustomKRKTaskDialog.CallbackProc(hwnd: HWND; msg: UINT; wParam: WPARAM; lParam: LPARAM; lpRefData: LONG_PTR): HResult;
460+var
461+ LCanClose, LReset: Boolean;
462+begin
463+ Result := S_OK;
464+
465+ case msg of
466+ TDN_BUTTON_CLICKED: begin
467+ LCanClose := True;
468+ DoOnButtonClicked(wParam, LCanClose);
469+
470+ if not LCanClose then
471+ Result := S_FALSE;
472+ end;
473+ TDN_CREATED: DoOnDialogCreated;
474+ TDN_DESTROYED: DoOnDialogDestroyed;
475+ TDN_DIALOG_CONSTRUCTED: begin
476+ FHandle := hwnd;
477+ FButtons.SetInitialState;
478+ FRadioButtons.SetInitialState;
479+ FProgressBar.Initialize;
480+ DoOnDialogConstructed;
481+ end;
482+ TDN_EXPANDO_BUTTON_CLICKED: DoOnExpandButtonClicked(BOOL(wParam));
483+ TDN_HELP: DoOnHelp;
484+ TDN_HYPERLINK_CLICKED: DoOnHyperlinkClicked(LPCWSTR(lParam));
485+ TDN_NAVIGATED: DoOnNavigated;
486+ TDN_RADIO_BUTTON_CLICKED: DoOnRadioButtonClicked(wParam);
487+ TDN_TIMER: begin
488+ LReset := False;
489+ DoOnTimer(wParam, LReset);
490+
491+ if LReset then
492+ Result := S_FALSE;
493+ end;
494+ TDN_VERIFICATION_CLICKED: DoOnVerificationClicked(wParam = 1);
495+ end;
496+end;
497+
498+constructor TCustomKRKTaskDialog.Create(AOwner: TComponent);
499+begin
500+ inherited Create(AOwner);
501+
502+ FButtons := TKRKTaskDialogButtons.Create(Self, TKRKTaskDialogButtonItem);
503+ FCommonButtons := [tcbOk, tcbCancel];
504+ FCustomFooterIcon := TIcon.Create;
505+ FCustomMainIcon := TIcon.Create;
506+ FDefaultButton := tcbOk;
507+ FFlags := [tfAllowDialogCancellation];
508+ FFooterIcon := tdiNone;
509+ FHandle := 0;
510+ FMainIcon := tdiInformation;
511+ FProgressBar := TKRKTaskDialogProgressBar.Create(Self);
512+ FRadioButtons := TKRKTaskDialogButtons.Create(Self, TKRKTaskDialogRadioButtonItem);
513+end;
514+
515+destructor TCustomKRKTaskDialog.Destroy;
516+begin
517+ FButtons.Free;
518+ FCustomFooterIcon.Free;
519+ FCustomMainIcon.Free;
520+ FProgressBar.Free;
521+ FRadioButtons.Free;
522+ inherited;
523+end;
524+
525+function TaskDialogCallbackProc(hwnd: HWND; msg: UINT; wParam: WPARAM; lParam: LPARAM; lpRefData: LONG_PTR): HResult; stdcall;
526+begin
527+ Result := TCustomKRKTaskDialog(Pointer(lpRefData)).CallbackProc(hwnd, msg, wparam, lparam, 0);
528+end;
529+
530+type
531+ TTaskDlgIconMapType = PWideChar;
532+
533+const
534+ CTaskDlgIcons: array[tdiNone..tdiShieldHeadGreen] of TTaskDlgIconMapType = (nil,
535+ TD_WARNING_ICON, TD_ERROR_ICON, TD_INFORMATION_ICON, TD_SHIELD_ICON,
536+ TD_SHIELD_ICON_HEAD_BLUE, TD_SHIELD_ICON_HEAD_WARNING,
537+ TD_SHIELD_ICON_HEAD_ERROR, TD_SHIELD_ICON_HEAD_OK,
538+ TD_SHIELD_ICON_HEAD_GREEN);
539+
540+{$IF CompilerVersion = 18}{$WARN SUSPICIOUS_TYPECAST OFF}{$IFEND} { Delphi 2006 }
541+function TCustomKRKTaskDialog.DoExecute(AParentWnd: HWND): Boolean;
542+const
543+ CTaskDlgFlags: array[TKRKTaskDialogFlag] of Cardinal = (TDF_ENABLE_HYPERLINKS,
544+ TDF_USE_HICON_MAIN, TDF_USE_HICON_FOOTER, TDF_ALLOW_DIALOG_CANCELLATION,
545+ TDF_USE_COMMAND_LINKS, TDF_USE_COMMAND_LINKS_NO_ICON,
546+ TDF_EXPAND_FOOTER_AREA, TDF_EXPANDED_BY_DEFAULT,
547+ TDF_VERIFICATION_FLAG_CHECKED, TDF_SHOW_PROGRESS_BAR,
548+ TDF_SHOW_MARQUEE_PROGRESS_BAR, TDF_CALLBACK_TIMER,
549+ TDF_POSITION_RELATIVE_TO_WINDOW, TDF_RTL_LAYOUT,
550+ TDF_NO_DEFAULT_RADIO_BUTTON, TDF_CAN_BE_MINIMIZED, TDF_SIZE_TO_CONTENT);
551+
552+ CTaskDlgCommonButtons: array[TKRKTaskDialogCommonButton] of Cardinal = (
553+ TDCBF_OK_BUTTON, TDCBF_YES_BUTTON, TDCBF_NO_BUTTON, TDCBF_CANCEL_BUTTON,
554+ TDCBF_RETRY_BUTTON, TDCBF_CLOSE_BUTTON);
555+
556+ CTaskDlgDefaultButtons: array[TKRKTaskDialogCommonButton] of Integer = (
557+ IDOK, IDYES, IDNO, IDCANCEL, IDRETRY, IDCLOSE);
558+
559+var
560+ LTaskWindowList: TTaskWindowList;
561+ LModalResult: Integer;
562+ LRadioButton: Integer;
563+ LKRKTaskDialogFlag: TKRKTaskDialogFlag;
564+ LFocusState: TFocusState;
565+ LVerificationChecked: LongBool;
566+ LTaskDialogConfig: TTaskDialogConfig;
567+ LKRKTaskDialogCommonButton: TKRKTaskDialogCommonButton;
568+begin
569+ if Win32MajorVersion < 6 then
570+ raise EPlatformVersionException.CreateResFmt(@SWindowsVistaRequired, [ClassName]);
571+
572+ ZeroMemory(@LTaskDialogConfig, SizeOf(LTaskDialogConfig));
573+
574+ with LTaskDialogConfig do
575+ begin
576+ cbSize := SizeOf(LTaskDialogConfig);
577+ hwndParent := AParentWnd;
578+ // TTaskDialogConfig contém o membro hInstance, que possui o handle do
579+ // módulo que contém dentre seus recursos o ícone indicado no membro
580+ // pszMainIcon ou pszFooterIcon e strings de recurso que podem ser
581+ // atribuídas aos membros a pszWindowTitle, pszMainInstruction, pszContent,
582+ // pszVerificationText, pszExpandedInformation, pszExpandedControlText,
583+ // pszCollapsedControlText ou pszFooter. A fim de simplificar este
584+ // componente não será possível usar esta forma de atribuição de membros com
585+ // recursos do módulo. Caso isso seja muito importante, considere usar a
586+ // função TaskDialogIndirect diretamente
587+ dwFlags := 0;
588+
589+ for LKRKTaskDialogFlag := Low(TKRKTaskDialogFlag) to High(TKRKTaskDialogFlag) do
590+ if LKRKTaskDialogFlag in FFlags then
591+ dwFlags := dwFlags or CTaskDlgFlags[LKRKTaskDialogFlag];
592+
593+ dwCommonButtons := 0;
594+
595+ for LKRKTaskDialogCommonButton := Low(TKRKTaskDialogCommonButton) to High(TKRKTaskDialogCommonButton) do
596+ if LKRKTaskDialogCommonButton in FCommonButtons then
597+ dwCommonButtons := dwCommonButtons or CTaskDlgCommonButtons[LKRKTaskDialogCommonButton];
598+
599+ if FWindowTitle <> '' then
600+ pszWindowTitle := PWideChar(FWindowTitle);
601+
602+ if tfUseHiconMain in FFlags then
603+ hMainIcon := FCustomMainIcon.Handle
604+ else
605+ begin
606+ if FMainIcon in [tdiNone..tdiShieldHeadGreen] then
607+ pszMainIcon := LPCWSTR(CTaskDlgIcons[FMainIcon])
608+ else
609+ pszMainIcon := LPCWSTR(MAKEINTRESOURCEW(Word(FMainIcon)));
610+ end;
611+
612+ if FMainInstruction <> '' then
613+ pszMainInstruction := PWideChar(FMainInstruction);
614+
615+ if FContent <> '' then
616+ pszContent := PWideChar(FContent);
617+
618+ cButtons := FButtons.Count;
619+
620+ if cButtons > 0 then
621+ pButtons := FButtons.Buttons;
622+
623+ nDefaultButton := CTaskDlgDefaultButtons[FDefaultButton];
624+
625+ if Assigned(FButtons.DefaultButton) then
626+ nDefaultButton := FButtons.DefaultButton.ModalResult;
627+
628+ cRadioButtons := FRadioButtons.Count;
629+
630+ if cRadioButtons > 0 then
631+ pRadioButtons := FRadioButtons.Buttons;
632+
633+ if not (tfNoDefaultRadioButton in FFlags) and Assigned(FRadioButtons.DefaultButton) then
634+ nDefaultRadioButton := FRadioButtons.DefaultButton.ModalResult;
635+
636+ if FVerificationText <> '' then
637+ pszVerificationText := PWideChar(FVerificationText);
638+
639+ if FExpandedInformation <> '' then
640+ pszExpandedInformation := PWideChar(FExpandedInformation);
641+
642+ if FExpandedControlText <> '' then
643+ pszExpandedControlText := PWideChar(FExpandedControlText);
644+
645+ if FCollapsedControlText <> '' then
646+ pszCollapsedControlText := PWideChar(FCollapsedControlText);
647+
648+ if tfUseHiconFooter in FFlags then
649+ hFooterIcon := FCustomFooterIcon.Handle
650+ else
651+ begin
652+ if FFooterIcon in [tdiNone..tdiShield] then
653+ pszFooterIcon := LPCWSTR(CTaskDlgIcons[FFooterIcon])
654+ else
655+ pszFooterIcon := LPCWSTR(MakeIntResourceW(Word(FFooterIcon)));
656+ end;
657+
658+ if FFooter <> '' then
659+ pszFooter := PWideChar(FFooter);
660+
661+ pfCallback := @TaskDialogCallbackProc;
662+ lpCallbackData := LONG_PTR(Self);
663+ end;
664+
665+ LTaskWindowList := DisableTaskWindows(AParentWnd);
666+
667+ LFocusState := SaveFocusState;
668+ try
669+ Result := TaskDialogIndirect(LTaskDialogConfig, @LModalResult, @LRadioButton, @LVerificationChecked) = S_OK;
670+ FModalResult := LModalResult;
671+
672+ if Result then
673+ begin
674+ FButton := TKRKTaskDialogButtonItem(FButtons.FindButton(FModalResult));
675+ FRadioButton := TKRKTaskDialogRadioButtonItem(FRadioButtons.FindButton(LRadioButton));
676+
677+ if LVerificationChecked then
678+ Include(FFlags, tfVerificationFlagChecked)
679+ else
680+ Exclude(FFlags, tfVerificationFlagChecked);
681+ end;
682+ finally
683+ EnableTaskWindows(LTaskWindowList);
684+ SetActiveWindow(AParentWnd);
685+ RestoreFocusState(LFocusState);
686+ end;
687+end;
688+{$IF CompilerVersion = 18}{$WARN SUSPICIOUS_TYPECAST ON}{$IFEND} { Delphi 2006 }
689+
690+procedure TCustomKRKTaskDialog.DoOnButtonClicked(AModalResult: Integer; var ACanClose: Boolean);
691+begin
692+ if Assigned(FOnButtonClicked) then
693+ begin
694+ FButton := TKRKTaskDialogButtonItem(FButtons.FindButton(AModalResult));
695+ FOnButtonClicked(Self, AModalResult, ACanClose);
696+ end;
697+end;
698+
699+procedure TCustomKRKTaskDialog.DoOnDialogConstructed;
700+begin
701+ if Assigned(FOnDialogConstructed) then
702+ FOnDialogConstructed(Self);
703+end;
704+
705+procedure TCustomKRKTaskDialog.DoOnDialogCreated;
706+begin
707+ if Assigned(FOnDialogCreated) then
708+ FOnDialogCreated(Self);
709+end;
710+
711+procedure TCustomKRKTaskDialog.DoOnDialogDestroyed;
712+begin
713+ if Assigned(FOnDialogDestroyed) then
714+ FOnDialogDestroyed(Self);
715+end;
716+
717+procedure TCustomKRKTaskDialog.DoOnExpandButtonClicked(AExpanded: Boolean);
718+begin
719+ if Assigned(FOnExpanded) then
720+ begin
721+ FExpanded := AExpanded;
722+ FOnExpanded(Self);
723+ end;
724+end;
725+
726+procedure TCustomKRKTaskDialog.DoOnHelp;
727+begin
728+ if FHelpContext <> 0 then
729+ try
730+ Application.HelpContext(FHelpContext);
731+ except
732+ on E: Exception do
733+ ShowHelpException(E);
734+ end;
735+end;
736+
737+procedure TCustomKRKTaskDialog.DoOnHyperlinkClicked(const AURL: string);
738+begin
739+ if Assigned(FOnHyperlinkClicked) then
740+ begin
741+ FURL := AURL;
742+ FOnHyperlinkClicked(Self);
743+ end;
744+end;
745+
746+procedure TCustomKRKTaskDialog.DoOnNavigated;
747+begin
748+ if Assigned(FOnNavigated) then
749+ FOnNavigated(Self);
750+end;
751+
752+procedure TCustomKRKTaskDialog.DoOnRadioButtonClicked(AButtonID: Integer);
753+begin
754+ if Assigned(FOnRadioButtonClicked) then
755+ begin
756+ FRadioButton := TKRKTaskDialogRadioButtonItem(FRadioButtons.FindButton(AButtonID));
757+ FOnRadioButtonClicked(Self);
758+ end;
759+end;
760+
761+procedure TCustomKRKTaskDialog.DoOnTimer(ATickCount: Cardinal; var AReset: Boolean);
762+begin
763+ if Assigned(FOnTimer) then
764+ FOnTimer(Self, ATickCount, AReset);
765+end;
766+
767+procedure TCustomKRKTaskDialog.DoOnVerificationClicked(AChecked: Boolean);
768+begin
769+ if Assigned(FOnVerificationClicked) then
770+ begin
771+ if AChecked then
772+ Include(FFlags, tfVerificationFlagChecked)
773+ else
774+ Exclude(FFlags, tfVerificationFlagChecked);
775+
776+ FOnVerificationClicked(Self);
777+ end;
778+end;
779+
780+function TCustomKRKTaskDialog.Execute: Boolean;
781+var
782+ LParentWnd: HWND;
783+begin
784+ if Assigned(Screen.ActiveForm) and (Screen.ActiveForm.FormStyle <> fsMDIChild) then
785+ LParentWnd := Screen.ActiveForm.Handle
786+ else
787+ begin
788+ LParentWnd := Application.ActiveFormHandle;
789+
790+ if LParentWnd = 0 then
791+ LParentWnd := Application.Handle;
792+ end;
793+
794+ Result := Execute(LParentWnd);
795+end;
796+
797+function TCustomKRKTaskDialog.Execute(AParentWnd: HWND): Boolean;
798+begin
799+ FModalResult := 0;
800+ Result := DoExecute(AParentWnd);
801+end;
802+
803+procedure TCustomKRKTaskDialog.SetButtons(const AValue: TKRKTaskDialogButtons);
804+begin
805+ if AValue <> FButtons then
806+ FButtons.Assign(AValue);
807+end;
808+
809+procedure TCustomKRKTaskDialog.SetCustomFooterIcon(const AValue: TIcon);
810+begin
811+ if AValue <> FCustomFooterIcon then
812+ FCustomFooterIcon.Assign(AValue);
813+end;
814+
815+procedure TCustomKRKTaskDialog.SetCustomMainIcon(const AValue: TIcon);
816+begin
817+ if AValue <> FCustomMainIcon then
818+ FCustomMainIcon.Assign(AValue);
819+end;
820+
821+procedure TCustomKRKTaskDialog.SetExpandedInformation(const AValue: string);
822+begin
823+ if AValue <> FExpandedInformation then
824+ begin
825+ FExpandedInformation := AValue;
826+
827+ if FHandle <> 0 then
828+ SendTextMessage(FHandle, TDM_UPDATE_ELEMENT_TEXT, TDE_EXPANDED_INFORMATION, FExpandedInformation);
829+ end;
830+end;
831+
451832 procedure TCustomKRKTaskDialog.SetFlags(const AValue: TKRKTaskDialogFlags);
452833 begin
453834 if AValue <> FFlags then
@@ -459,6 +840,105 @@
459840 end;
460841 end;
461842
843+procedure TCustomKRKTaskDialog.SetFooterIcon(const AValue: TKRKTaskDialogIcon);
844+begin
845+ if AValue <> FFooterIcon then
846+ begin
847+ FFooterIcon := AValue;
848+
849+ if FHandle <> 0 then
850+ SendMessage(FHandle, TDM_UPDATE_ICON, TDIE_ICON_FOOTER, LPARAM(CTaskDlgIcons[FFooterIcon]));
851+ end;
852+end;
853+
854+procedure TCustomKRKTaskDialog.SetFooter(const AValue: string);
855+begin
856+ if AValue <> FFooter then
857+ begin
858+ FFooter := AValue;
859+
860+ if FHandle <> 0 then
861+ SendTextMessage(FHandle, TDM_UPDATE_ELEMENT_TEXT, TDE_FOOTER, FFooter);
862+ end;
863+end;
864+
865+procedure TCustomKRKTaskDialog.SetMainIcon(const AValue: TKRKTaskDialogIcon);
866+begin
867+ if AValue <> FMainIcon then
868+ begin
869+ FMainIcon := AValue;
870+
871+ if FHandle <> 0 then
872+ SendMessage(FHandle, TDM_UPDATE_ICON, TDIE_ICON_MAIN, LPARAM(CTaskDlgIcons[FMainIcon]));
873+ end;
874+end;
875+
876+procedure TCustomKRKTaskDialog.SetRadioButtons(const AValue: TKRKTaskDialogButtons);
877+begin
878+ if AValue <> FRadioButtons then
879+ FRadioButtons.Assign(AValue);
880+end;
881+
882+procedure TCustomKRKTaskDialog.SetContent(const AValue: string);
883+begin
884+ if AValue <> FContent then
885+ begin
886+ FContent := AValue;
887+
888+ if FHandle <> 0 then
889+ SendTextMessage(FHandle, TDM_UPDATE_ELEMENT_TEXT, TDE_CONTENT, FContent);
890+ end;
891+end;
892+
893+procedure TCustomKRKTaskDialog.SetMainInstruction(const AValue: string);
894+begin
895+ if AValue <> FMainInstruction then
896+ begin
897+ FMainInstruction := AValue;
898+
899+ if FHandle <> 0 then
900+ SendTextMessage(FHandle, TDM_UPDATE_ELEMENT_TEXT, TDE_MAIN_INSTRUCTION, FMainInstruction);
901+ end;
902+end;
903+
904+procedure TCustomKRKTaskDialog.ShowHelpException(AE: Exception);
905+var
906+ Msg: string;
907+ Flags: Integer;
908+{$IF CompilerVersion >= 20} { Delphi 2009 }
909+ SubE: Exception;
910+{$IFEND}
911+begin
912+ Flags := MB_OK or MB_ICONSTOP;
913+
914+ if Application.UseRightToLeftReading then
915+ Flags := Flags or MB_RTLREADING;
916+
917+ Msg := AE.Message;
918+
919+{$IF CompilerVersion >= 20} { Delphi 2009 }
920+ while True do
921+ begin
922+ SubE := AE.GetBaseException;
923+
924+ if SubE <> AE then
925+ begin
926+ AE := SubE;
927+
928+ if AE.Message <> '' then
929+ Msg := AE.Message;
930+ end
931+ else
932+ Break;
933+ end;
934+{$IFEND}
935+
936+ if (Msg <> '') and (Msg[Length(Msg)] > '.') then
937+ Msg := Msg + '.';
938+
939+ MessageBox(FHandle, PChar(Msg), PChar(Application.Title), Flags);
940+end;
941+
462942 { TKRKTaskDialogBaseButtonItem }
463943
464944 procedure TKRKTaskDialogBaseButtonItem.Click;
@@ -701,6 +1181,7 @@
7011181 constructor TKRKTaskDialogButtonsEnumerator.Create(ACollection: TKRKTaskDialogButtons);
7021182 begin
7031183 inherited Create;
1184+
7041185 FIndex := -1;
7051186 FCollection := ACollection;
7061187 end;
--- trunk/rtp/src/Vcl/KRK.Vcl.Forms.pas (revision 582)
+++ trunk/rtp/src/Vcl/KRK.Vcl.Forms.pas (revision 583)
@@ -8,6 +8,10 @@
88 KRK.Vcl.StdCtrls, KRK.Rtl.Common.Classes, KRK.Rtl.Win.CommCtrl;
99
1010 type
11+{$IF CompilerVersion = 18}
12+ TTaskWindowList = Pointer;
13+{$IFEND}
14+
1115 TVisibleButton = (vbOk,vbYes,vbYesToAll,vbNo,vbIgnore,vbCancel,vbClose,vbHelp);
1216 TVisibleButtons = set of TVisibleButton;
1317
Show on old repository browser