mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 23:08:05 +02:00
TaskDialog: implement OnNavigated (native Windows Vista+ only) and OnHelp.
While Delphi has DoOnHelp protected method, it seems they do not have OnHelp (GOKY).
This commit is contained in:
parent
5d37c8659e
commit
70b158940e
@ -642,7 +642,9 @@ type
|
|||||||
FOnDialogCreated: TNotifyEvent;
|
FOnDialogCreated: TNotifyEvent;
|
||||||
FOnDialogDestroyed: TNotifyEvent;
|
FOnDialogDestroyed: TNotifyEvent;
|
||||||
FOnExpanded: TNotifyEvent;
|
FOnExpanded: TNotifyEvent;
|
||||||
|
FOnHelp: TNotifyEvent;
|
||||||
FOnHyperlinkClicked: TNotifyEvent;
|
FOnHyperlinkClicked: TNotifyEvent;
|
||||||
|
FOnNavigated: TNotifyEvent;
|
||||||
FOnRadioButtonClicked: TNotifyEvent;
|
FOnRadioButtonClicked: TNotifyEvent;
|
||||||
FOnTimer: TTaskDlgTimerEvent;
|
FOnTimer: TTaskDlgTimerEvent;
|
||||||
FOnVerificationClicked: TNotifyEvent;
|
FOnVerificationClicked: TNotifyEvent;
|
||||||
@ -674,9 +676,12 @@ type
|
|||||||
procedure DoOnExpandButtonClicked(Expanded: Boolean); dynamic;
|
procedure DoOnExpandButtonClicked(Expanded: Boolean); dynamic;
|
||||||
procedure DoOnTimer(TickCount: Cardinal; var Reset: Boolean); dynamic;
|
procedure DoOnTimer(TickCount: Cardinal; var Reset: Boolean); dynamic;
|
||||||
procedure DoOnVerificationClicked(Checked: Boolean); dynamic;
|
procedure DoOnVerificationClicked(Checked: Boolean); dynamic;
|
||||||
//procedure DoOnHelp; dynamic;
|
procedure DoOnHelp; dynamic;
|
||||||
procedure DoOnHyperlinkClicked(const AURL: string); dynamic;
|
procedure DoOnHyperlinkClicked(const AURL: string); dynamic;
|
||||||
//procedure DoOnNavigated; dynamic;
|
|
||||||
|
//requires that a TaskDialog has pages, (see: https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.taskdialogpage.navigate?view=windowsdesktop-7.0)
|
||||||
|
//which might be implemented in a derived class, but the event handler must be in base class for Delphi compatibility.
|
||||||
|
procedure DoOnNavigated; dynamic;
|
||||||
|
|
||||||
procedure SetRadioButtonFromRadioIndex(AIndex: Integer);
|
procedure SetRadioButtonFromRadioIndex(AIndex: Integer);
|
||||||
public
|
public
|
||||||
@ -720,6 +725,8 @@ type
|
|||||||
property OnTimer: TTaskDlgTimerEvent read FOnTimer write FOnTimer;
|
property OnTimer: TTaskDlgTimerEvent read FOnTimer write FOnTimer;
|
||||||
property OnRadioButtonClicked: TNotifyEvent read FOnRadioButtonClicked write FOnRadioButtonClicked;
|
property OnRadioButtonClicked: TNotifyEvent read FOnRadioButtonClicked write FOnRadioButtonClicked;
|
||||||
property OnHyperlinkClicked: TNotifyEvent read FOnHyperlinkClicked write FOnHyperlinkClicked;
|
property OnHyperlinkClicked: TNotifyEvent read FOnHyperlinkClicked write FOnHyperlinkClicked;
|
||||||
|
property OnNavigated: TNotifyEvent read FOnNavigated write FOnNavigated;
|
||||||
|
property OnHelp: TNotifyEvent read FOnHelp write FOnHelp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TTaskDialog = class(TCustomTaskDialog)
|
TTaskDialog = class(TCustomTaskDialog)
|
||||||
|
@ -220,6 +220,12 @@ begin
|
|||||||
FOnVerificationClicked(Self);
|
FOnVerificationClicked(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTaskDialog.DoOnHelp;
|
||||||
|
begin
|
||||||
|
if Assigned(FonHelp) then
|
||||||
|
FOnHelp(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomTaskDialog.DoOnHyperlinkClicked(const AURL: string);
|
procedure TCustomTaskDialog.DoOnHyperlinkClicked(const AURL: string);
|
||||||
begin
|
begin
|
||||||
FURL := AURL;
|
FURL := AURL;
|
||||||
@ -227,6 +233,12 @@ begin
|
|||||||
FOnHyperlinkClicked(Self);
|
FOnHyperlinkClicked(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTaskDialog.DoOnNavigated;
|
||||||
|
begin
|
||||||
|
if Assigned(FOnNavigated) then
|
||||||
|
FOnNavigated(Self);
|
||||||
|
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
|
||||||
|
@ -1721,7 +1721,11 @@ begin
|
|||||||
lParam: Must be zero.
|
lParam: Must be zero.
|
||||||
Return value: The return value is ignored.
|
Return value: The return value is ignored.
|
||||||
}
|
}
|
||||||
if IsConsole then writeln('ToDo: implement OnNavigated');
|
Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog');
|
||||||
|
{$PUSH}
|
||||||
|
{$ObjectChecks OFF}
|
||||||
|
TTaskDialogAccess(Dlg).DoOnNavigated;
|
||||||
|
{$POP}
|
||||||
end;
|
end;
|
||||||
TDN_TIMER:
|
TDN_TIMER:
|
||||||
begin
|
begin
|
||||||
@ -1769,7 +1773,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
TDN_HELP:
|
TDN_HELP:
|
||||||
begin
|
begin
|
||||||
if IsConsole then writeln('ToDo: implement TDN_HELP??');
|
Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog');
|
||||||
|
{$PUSH}
|
||||||
|
{$ObjectChecks OFF}
|
||||||
|
TTaskDialogAccess(Dlg).DoOnHelp;
|
||||||
|
{$POP}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -67,6 +67,7 @@ type
|
|||||||
procedure OnRadioButtonClick(Sender: TObject);
|
procedure OnRadioButtonClick(Sender: TObject);
|
||||||
procedure OnVerifyClicked(Sender: TObject);
|
procedure OnVerifyClicked(Sender: TObject);
|
||||||
procedure OnTimer(Sender: TObject);
|
procedure OnTimer(Sender: TObject);
|
||||||
|
procedure DoOnHelp;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
procedure SetupControls;
|
procedure SetupControls;
|
||||||
@ -700,6 +701,14 @@ begin
|
|||||||
ResetTimer;
|
ResetTimer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLCLTaskDialog.DoOnHelp;
|
||||||
|
begin
|
||||||
|
{$PUSH}
|
||||||
|
{$ObjectChecks OFF}
|
||||||
|
{%H-}TTaskDialogAccess(FDlg).DoOnHelp;
|
||||||
|
{$POP}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLCLTaskDialog.OnRadioButtonClick(Sender: TObject);
|
procedure TLCLTaskDialog.OnRadioButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
ButtonID: Integer;
|
ButtonID: Integer;
|
||||||
@ -957,7 +966,11 @@ begin
|
|||||||
if (Key = VK_F4) and (ssAlt in Shift) then//IMPORTANT: native task dialog blocks Alt+F4 to close the dialog -> we have to block it as well
|
if (Key = VK_F4) and (ssAlt in Shift) then//IMPORTANT: native task dialog blocks Alt+F4 to close the dialog -> we have to block it as well
|
||||||
Key := 0;
|
Key := 0;
|
||||||
end;
|
end;
|
||||||
|
if (Key = VK_F1) and (Shift = []) then
|
||||||
|
begin
|
||||||
|
Key := 0;
|
||||||
|
DoOnHelp;
|
||||||
|
end;
|
||||||
inherited KeyDown(Key, Shift);
|
inherited KeyDown(Key, Shift);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user