mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-08 12:58:25 +02:00
TTaskDialog: implement property Handle. Makes it possible to send messages to the dialog.
This is needed to implement e.g. progressbar and can be used to update on-the-fly the contents of the dialog.
This commit is contained in:
parent
dde185549b
commit
cf5777a164
@ -652,6 +652,7 @@ type
|
|||||||
FFlags: TTaskDialogFlags;
|
FFlags: TTaskDialogFlags;
|
||||||
FFooterIcon: TTaskDialogIcon;
|
FFooterIcon: TTaskDialogIcon;
|
||||||
FFooterText: TTranslateString;
|
FFooterText: TTranslateString;
|
||||||
|
FHandle: THandle;
|
||||||
FMainIcon: TTaskDialogIcon;
|
FMainIcon: TTaskDialogIcon;
|
||||||
FModalResult: TModalResult;
|
FModalResult: TModalResult;
|
||||||
FOnDialogConstructed: TNotifyEvent;
|
FOnDialogConstructed: TNotifyEvent;
|
||||||
@ -703,6 +704,8 @@ type
|
|||||||
//which might be implemented in a derived class, but the event handler must be in base class for Delphi compatibility.
|
//which might be implemented in a derived class, but the event handler must be in base class for Delphi compatibility.
|
||||||
procedure DoOnNavigated; dynamic;
|
procedure DoOnNavigated; dynamic;
|
||||||
|
|
||||||
|
procedure InternalSetDialogHandle(AHandle: THandle); //only to be called from the dialog window
|
||||||
|
|
||||||
procedure SetRadioButtonFromRadioIndex(AIndex: Integer);
|
procedure SetRadioButtonFromRadioIndex(AIndex: Integer);
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@ -724,6 +727,7 @@ type
|
|||||||
property FooterIcon: TTaskDialogIcon read FFooterIcon write FFooterIcon default tdiNone;
|
property FooterIcon: TTaskDialogIcon read FFooterIcon write FFooterIcon default tdiNone;
|
||||||
property FooterText: TTranslateString read FFooterText write FFooterText;
|
property FooterText: TTranslateString read FFooterText write FFooterText;
|
||||||
property MainIcon: TTaskDialogIcon read FMainIcon write FMainIcon default tdiInformation;
|
property MainIcon: TTaskDialogIcon read FMainIcon write FMainIcon default tdiInformation;
|
||||||
|
property Handle: THandle read FHandle; //Handle to the dialog window
|
||||||
property ModalResult: TModalResult read FModalResult write FModalResult;
|
property ModalResult: TModalResult read FModalResult write FModalResult;
|
||||||
property QueryChoices: TStrings read FQueryChoices write SetQueryChoices;
|
property QueryChoices: TStrings read FQueryChoices write SetQueryChoices;
|
||||||
property QueryItemIndex: Integer read FQueryItemIndex write FQueryItemIndex;
|
property QueryItemIndex: Integer read FQueryItemIndex write FQueryItemIndex;
|
||||||
|
@ -98,6 +98,8 @@ begin
|
|||||||
|
|
||||||
FCustomFooterIcon := TIcon.Create;
|
FCustomFooterIcon := TIcon.Create;
|
||||||
FCustomMainIcon := TIcon.Create;
|
FCustomMainIcon := TIcon.Create;
|
||||||
|
|
||||||
|
FHandle := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomTaskDialog.ButtonIDToModalResult(const AButtonID: Integer
|
function TCustomTaskDialog.ButtonIDToModalResult(const AButtonID: Integer
|
||||||
@ -244,6 +246,11 @@ begin
|
|||||||
FOnNavigated(Self);
|
FOnNavigated(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTaskDialog.InternalSetDialogHandle(AHandle: THandle);
|
||||||
|
begin
|
||||||
|
FHandle := AHandle;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomTaskDialog.SetRadioButtonFromRadioIndex(AIndex: Integer);
|
procedure TCustomTaskDialog.SetRadioButtonFromRadioIndex(AIndex: Integer);
|
||||||
begin
|
begin
|
||||||
if (AIndex >= TaskDialogFirstRadioButtonIndex) and (AIndex-TaskDialogFirstRadioButtonIndex < RadioButtons.Count) then
|
if (AIndex >= TaskDialogFirstRadioButtonIndex) and (AIndex-TaskDialogFirstRadioButtonIndex < RadioButtons.Count) then
|
||||||
|
@ -1663,6 +1663,10 @@ begin
|
|||||||
Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog');
|
Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog');
|
||||||
{$PUSH}
|
{$PUSH}
|
||||||
{$ObjectChecks OFF}
|
{$ObjectChecks OFF}
|
||||||
|
//testing shows that hwnd is the same in all notifications
|
||||||
|
//and since TDN_DIALOG_CONSTRUCTED comes first, just set it here
|
||||||
|
//so any OnTaskDialogxxx event will have access to the correct handle.
|
||||||
|
TTaskDialogAccess(Dlg).InternalSetDialogHandle(hwnd);
|
||||||
TTaskDialogAccess(Dlg).DoOnDialogConstructed;
|
TTaskDialogAccess(Dlg).DoOnDialogConstructed;
|
||||||
{$POP}
|
{$POP}
|
||||||
end;
|
end;
|
||||||
|
@ -960,6 +960,7 @@ procedure TLCLTaskDialog.DoDialogConstructed;
|
|||||||
begin
|
begin
|
||||||
{$PUSH}
|
{$PUSH}
|
||||||
{$ObjectChecks OFF}
|
{$ObjectChecks OFF}
|
||||||
|
{%H-}TTaskDialogAccess(FDlg).InternalSetDialogHandle(Handle);
|
||||||
{%H-}TTaskDialogAccess(FDlg).DoOnDialogConstructed;
|
{%H-}TTaskDialogAccess(FDlg).DoOnDialogConstructed;
|
||||||
{$POP}
|
{$POP}
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user