TCustomTaskDialog: inherit form TLCLComponent and register the widgetset class.

This commit is contained in:
Bart 2023-07-17 13:52:40 +02:00
parent 6fb319fae8
commit fc6bbcc936
5 changed files with 16 additions and 3 deletions

View File

@ -613,7 +613,9 @@ type
property Items[Index: Integer]: TTaskDialogBaseButtonItem read GetItem write SetItem; default;
end;
TCustomTaskDialog = class(TComponent)
{ TCustomTaskDialog }
TCustomTaskDialog = class(TLCLComponent)
private
FButton: TTaskDialogButtonItem;
FButtons: TTaskDialogButtons;
@ -640,6 +642,7 @@ type
procedure SetRadioButtons(const Value: TTaskDialogButtons);
function ButtonIDToModalResult(const AButtonID: Integer): TModalResult;
protected
class procedure WSRegisterClass; override;
function DoExecute(ParentWnd: HWND): Boolean; dynamic;
procedure DoOnButtonClicked(AModalResult: Integer; var ACanClose: Boolean); dynamic;
public

View File

@ -118,6 +118,13 @@ begin
Result := mrNone;
end;
class procedure TCustomTaskDialog.WSRegisterClass;
begin
inherited WSRegisterClass;
RegisterTaskDialog;
end;
destructor TCustomTaskDialog.Destroy;
begin
FButtons.Free;

View File

@ -1576,6 +1576,7 @@ end;
class function TWin32WSTaskDialog.Execute(const ADlg: TCustomTaskDialog): Boolean;
begin
//writeln('TWin32WSTaskDialog.Execute');
Result := inherited Execute(ADlg);
end;

View File

@ -16,6 +16,7 @@ implementation
function ExecuteLCLTaskDialog(const ADlg: TTaskDialog): Boolean;
begin
//writeln('ExecuteLCLTaskDialog');
Result := False;
end;

View File

@ -103,8 +103,8 @@ type
end;
{ TWSTaskDialog }
TWSTaskDialog = class(TWSCommonDialog)
TWSTaskDialogClass = class of TWSTaskDialog;
TWSTaskDialog = class(TWSLCLComponent)
published
class function Execute(const ADlg: TCustomTaskDialog): Boolean; virtual;
end;
@ -200,6 +200,7 @@ end;
class function TWSTaskDialog.Execute(const ADlg: TCustomTaskDialog): Boolean;
begin
//writeln('TWSTaskDialog.Execute');
Result := ExecuteLCLTaskDialog(TTaskDialog(ADlg));
end;