mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 07:18:14 +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;
|
||||
FOnDialogDestroyed: TNotifyEvent;
|
||||
FOnExpanded: TNotifyEvent;
|
||||
FOnHelp: TNotifyEvent;
|
||||
FOnHyperlinkClicked: TNotifyEvent;
|
||||
FOnNavigated: TNotifyEvent;
|
||||
FOnRadioButtonClicked: TNotifyEvent;
|
||||
FOnTimer: TTaskDlgTimerEvent;
|
||||
FOnVerificationClicked: TNotifyEvent;
|
||||
@ -674,9 +676,12 @@ type
|
||||
procedure DoOnExpandButtonClicked(Expanded: Boolean); dynamic;
|
||||
procedure DoOnTimer(TickCount: Cardinal; var Reset: Boolean); dynamic;
|
||||
procedure DoOnVerificationClicked(Checked: Boolean); dynamic;
|
||||
//procedure DoOnHelp; dynamic;
|
||||
procedure DoOnHelp; 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);
|
||||
public
|
||||
@ -720,6 +725,8 @@ type
|
||||
property OnTimer: TTaskDlgTimerEvent read FOnTimer write FOnTimer;
|
||||
property OnRadioButtonClicked: TNotifyEvent read FOnRadioButtonClicked write FOnRadioButtonClicked;
|
||||
property OnHyperlinkClicked: TNotifyEvent read FOnHyperlinkClicked write FOnHyperlinkClicked;
|
||||
property OnNavigated: TNotifyEvent read FOnNavigated write FOnNavigated;
|
||||
property OnHelp: TNotifyEvent read FOnHelp write FOnHelp;
|
||||
end;
|
||||
|
||||
TTaskDialog = class(TCustomTaskDialog)
|
||||
|
@ -220,6 +220,12 @@ begin
|
||||
FOnVerificationClicked(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomTaskDialog.DoOnHelp;
|
||||
begin
|
||||
if Assigned(FonHelp) then
|
||||
FOnHelp(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomTaskDialog.DoOnHyperlinkClicked(const AURL: string);
|
||||
begin
|
||||
FURL := AURL;
|
||||
@ -227,6 +233,12 @@ begin
|
||||
FOnHyperlinkClicked(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomTaskDialog.DoOnNavigated;
|
||||
begin
|
||||
if Assigned(FOnNavigated) then
|
||||
FOnNavigated(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomTaskDialog.SetRadioButtonFromRadioIndex(AIndex: Integer);
|
||||
begin
|
||||
if (AIndex >= TaskDialogFirstRadioButtonIndex) and (AIndex-TaskDialogFirstRadioButtonIndex < RadioButtons.Count) then
|
||||
|
@ -1721,7 +1721,11 @@ begin
|
||||
lParam: Must be zero.
|
||||
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;
|
||||
TDN_TIMER:
|
||||
begin
|
||||
@ -1769,7 +1773,11 @@ begin
|
||||
end;
|
||||
TDN_HELP:
|
||||
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;
|
||||
|
@ -67,6 +67,7 @@ type
|
||||
procedure OnRadioButtonClick(Sender: TObject);
|
||||
procedure OnVerifyClicked(Sender: TObject);
|
||||
procedure OnTimer(Sender: TObject);
|
||||
procedure DoOnHelp;
|
||||
|
||||
protected
|
||||
procedure SetupControls;
|
||||
@ -700,6 +701,14 @@ begin
|
||||
ResetTimer;
|
||||
end;
|
||||
|
||||
procedure TLCLTaskDialog.DoOnHelp;
|
||||
begin
|
||||
{$PUSH}
|
||||
{$ObjectChecks OFF}
|
||||
{%H-}TTaskDialogAccess(FDlg).DoOnHelp;
|
||||
{$POP}
|
||||
end;
|
||||
|
||||
procedure TLCLTaskDialog.OnRadioButtonClick(Sender: TObject);
|
||||
var
|
||||
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
|
||||
Key := 0;
|
||||
end;
|
||||
|
||||
if (Key = VK_F1) and (Shift = []) then
|
||||
begin
|
||||
Key := 0;
|
||||
DoOnHelp;
|
||||
end;
|
||||
inherited KeyDown(Key, Shift);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user