mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 18:39:09 +02:00
lcl: add TApplicationProperties.OnActivate, OnDeactivate events
git-svn-id: trunk@35503 -
This commit is contained in:
parent
1b0fc1ad3d
commit
2f4158711d
14
lcl/forms.pp
14
lcl/forms.pp
@ -1543,6 +1543,8 @@ type
|
|||||||
FHintPause: Integer;
|
FHintPause: Integer;
|
||||||
FHintShortCuts: Boolean;
|
FHintShortCuts: Boolean;
|
||||||
FHintShortPause: Integer;
|
FHintShortPause: Integer;
|
||||||
|
FOnActivate: TNotifyEvent;
|
||||||
|
FOnDeactivate: TNotifyEvent;
|
||||||
FOnDropFiles: TDropFilesEvent;
|
FOnDropFiles: TDropFilesEvent;
|
||||||
FOnGetMainFormHandle: TGetHandleEvent;
|
FOnGetMainFormHandle: TGetHandleEvent;
|
||||||
FOnModalBegin: TNotifyEvent;
|
FOnModalBegin: TNotifyEvent;
|
||||||
@ -1579,6 +1581,8 @@ type
|
|||||||
procedure SetShowMainForm(const AValue: Boolean);
|
procedure SetShowMainForm(const AValue: Boolean);
|
||||||
procedure SetTitle(const AValue : String);
|
procedure SetTitle(const AValue : String);
|
||||||
|
|
||||||
|
procedure SetOnActivate(AValue: TNotifyEvent);
|
||||||
|
procedure SetOnDeactivate(AValue: TNotifyEvent);
|
||||||
procedure SetOnException(const AValue : TExceptionEvent);
|
procedure SetOnException(const AValue : TExceptionEvent);
|
||||||
procedure SetOnGetMainFormHandle(const AValue: TGetHandleEvent);
|
procedure SetOnGetMainFormHandle(const AValue: TGetHandleEvent);
|
||||||
procedure SetOnIdle(const AValue : TIdleEvent);
|
procedure SetOnIdle(const AValue : TIdleEvent);
|
||||||
@ -1613,16 +1617,18 @@ type
|
|||||||
property ShowMainForm: Boolean read FShowMainForm write SetShowMainForm default True;
|
property ShowMainForm: Boolean read FShowMainForm write SetShowMainForm default True;
|
||||||
property Title: String read FTitle write SetTitle;
|
property Title: String read FTitle write SetTitle;
|
||||||
|
|
||||||
|
property OnActivate: TNotifyEvent read FOnActivate write SetOnActivate;
|
||||||
|
property OnDeactivate: TNotifyEvent read FOnDeactivate write SetOnDeactivate;
|
||||||
property OnException: TExceptionEvent read FOnException write SetOnException;
|
property OnException: TExceptionEvent read FOnException write SetOnException;
|
||||||
property OnGetMainFormHandle: TGetHandleEvent read FOnGetMainFormHandle write SetOnGetMainFormHandle;
|
property OnGetMainFormHandle: TGetHandleEvent read FOnGetMainFormHandle write SetOnGetMainFormHandle;
|
||||||
property OnIdle: TIdleEvent read FOnIdle write SetOnIdle;
|
property OnIdle: TIdleEvent read FOnIdle write SetOnIdle;
|
||||||
property OnIdleEnd: TNotifyEvent read FOnIdleEnd write SetOnIdleEnd;
|
property OnIdleEnd: TNotifyEvent read FOnIdleEnd write SetOnIdleEnd;
|
||||||
property OnEndSession : TNotifyEvent read FOnEndSession write SetOnEndSession;
|
property OnEndSession: TNotifyEvent read FOnEndSession write SetOnEndSession;
|
||||||
property OnQueryEndSession : TQueryEndSessionEvent read FOnQueryEndSession write SetOnQueryEndSession;
|
property OnQueryEndSession: TQueryEndSessionEvent read FOnQueryEndSession write SetOnQueryEndSession;
|
||||||
property OnMinimize : TNotifyEvent read FOnMinimize write SetOnMinimize;
|
property OnMinimize: TNotifyEvent read FOnMinimize write SetOnMinimize;
|
||||||
property OnModalBegin: TNotifyEvent read FOnModalBegin write SetOnModalBegin;
|
property OnModalBegin: TNotifyEvent read FOnModalBegin write SetOnModalBegin;
|
||||||
property OnModalEnd: TNotifyEvent read FOnModalEnd write SetOnModalEnd;
|
property OnModalEnd: TNotifyEvent read FOnModalEnd write SetOnModalEnd;
|
||||||
property OnRestore : TNotifyEvent read FOnRestore write SetOnRestore;
|
property OnRestore: TNotifyEvent read FOnRestore write SetOnRestore;
|
||||||
property OnDropFiles: TDropFilesEvent read FOnDropFiles write SetOnDropFiles;
|
property OnDropFiles: TDropFilesEvent read FOnDropFiles write SetOnDropFiles;
|
||||||
property OnHelp: THelpEvent read FOnHelp write SetOnHelp;
|
property OnHelp: THelpEvent read FOnHelp write SetOnHelp;
|
||||||
property OnHint: TNotifyEvent read FOnHint write SetOnHint;
|
property OnHint: TNotifyEvent read FOnHint write SetOnHint;
|
||||||
|
@ -50,6 +50,28 @@ begin
|
|||||||
Application.AddOnGetMainFormHandleHandler(FOnGetMainFormHandle);
|
Application.AddOnGetMainFormHandleHandler(FOnGetMainFormHandle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TApplicationProperties.SetOnActivate(AValue: TNotifyEvent);
|
||||||
|
begin
|
||||||
|
if (TMethod(FOnActivate).Data = TMethod(AValue).Data) and
|
||||||
|
(TMethod(FOnActivate).Code = TMethod(AValue).Code) then Exit;
|
||||||
|
if not (csDesigning in ComponentState) and Assigned(FOnActivate) then
|
||||||
|
Application.RemoveOnActivateHandler(FOnActivate);
|
||||||
|
FOnActivate := AValue;
|
||||||
|
if not (csDesigning in ComponentState) and Assigned(FOnActivate) then
|
||||||
|
Application.AddOnActivateHandler(FOnActivate);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TApplicationProperties.SetOnDeactivate(AValue: TNotifyEvent);
|
||||||
|
begin
|
||||||
|
if (TMethod(FOnDeactivate).Data = TMethod(AValue).Data) and
|
||||||
|
(TMethod(FOnDeactivate).Code = TMethod(AValue).Code) then Exit;
|
||||||
|
if not (csDesigning in ComponentState) and Assigned(FOnDeactivate) then
|
||||||
|
Application.RemoveOnDeactivateHandler(FOnDeactivate);
|
||||||
|
FOnDeactivate := AValue;
|
||||||
|
if not (csDesigning in ComponentState) and Assigned(FOnDeactivate) then
|
||||||
|
Application.AddOnDeactivateHandler(FOnDeactivate);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TApplicationProperties.SetCaptureExceptions(const AValue : boolean);
|
procedure TApplicationProperties.SetCaptureExceptions(const AValue : boolean);
|
||||||
begin
|
begin
|
||||||
FCaptureExceptions := AValue;
|
FCaptureExceptions := AValue;
|
||||||
@ -321,6 +343,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
FShowMainForm := True;
|
FShowMainForm := True;
|
||||||
|
|
||||||
|
FOnActivate := nil;
|
||||||
|
FOnDeactivate := nil;
|
||||||
FOnException := nil;
|
FOnException := nil;
|
||||||
FOnGetMainFormHandle := nil;
|
FOnGetMainFormHandle := nil;
|
||||||
FOnIdle := nil;
|
FOnIdle := nil;
|
||||||
@ -342,6 +366,8 @@ destructor TApplicationProperties.Destroy;
|
|||||||
begin
|
begin
|
||||||
if not (csDesigning in ComponentState) then
|
if not (csDesigning in ComponentState) then
|
||||||
begin
|
begin
|
||||||
|
Application.RemoveOnActivateHandler(FOnActivate);
|
||||||
|
Application.RemoveOnDeactivateHandler(FOnDeactivate);
|
||||||
Application.RemoveOnExceptionHandler(FOnException);
|
Application.RemoveOnExceptionHandler(FOnException);
|
||||||
Application.RemoveOnGetMainFormHandleHandler(FOnGetMainFormHandle);
|
Application.RemoveOnGetMainFormHandleHandler(FOnGetMainFormHandle);
|
||||||
Application.RemoveOnIdleHandler(FOnIdle);
|
Application.RemoveOnIdleHandler(FOnIdle);
|
||||||
|
Loading…
Reference in New Issue
Block a user