mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 22:40:30 +02:00
LCL, implements application.ExceptionDialog property as an option to choose what kind of exception dialog handler the user wants: a simple message box or dialog with ok/cancel button, issue #23243
git-svn-id: trunk@46574 -
This commit is contained in:
parent
a038f0907b
commit
a820e5a564
12
lcl/forms.pp
12
lcl/forms.pp
@ -1238,6 +1238,11 @@ type
|
||||
// and place all forms there to immitate a mobile platform
|
||||
);
|
||||
|
||||
TApplicationExceptionDlg = (
|
||||
aedOkCancelDialog, // Exception handler window will be a dialog with Ok/Cancel buttons
|
||||
aedOkMessageBox // Exception handler window will be a simple message box
|
||||
);
|
||||
|
||||
TApplicationShowGlyphs = (
|
||||
sbgAlways, // show them always (default)
|
||||
sbgNever, // show them never
|
||||
@ -1261,6 +1266,7 @@ type
|
||||
FComponentsToRelease: TFPList;
|
||||
FComponentsReleasing: TFPList;
|
||||
FCreatingForm: TForm;// currently created form (CreateForm), candidate for MainForm
|
||||
FExceptionDialog: TApplicationExceptionDlg;
|
||||
FExtendedKeysSupport: Boolean;
|
||||
FFindGlobalComponentEnabled: boolean;
|
||||
FFlags: TApplicationFlags;
|
||||
@ -1499,6 +1505,7 @@ type
|
||||
property CaptureExceptions: boolean read FCaptureExceptions
|
||||
write SetCaptureExceptions;
|
||||
property ExtendedKeysSupport: Boolean read FExtendedKeysSupport write FExtendedKeysSupport; // See VK_LSHIFT in LCLType for more details
|
||||
property ExceptionDialog: TApplicationExceptionDlg read FExceptionDialog write FExceptionDialog;
|
||||
property FindGlobalComponentEnabled: boolean read FFindGlobalComponentEnabled
|
||||
write FFindGlobalComponentEnabled;
|
||||
property Flags: TApplicationFlags read FFlags write SetFlags;
|
||||
@ -1562,6 +1569,8 @@ type
|
||||
TApplicationProperties = class(TLCLComponent)
|
||||
private
|
||||
FCaptureExceptions: boolean;
|
||||
FExceptionDialogType: TApplicationExceptionDlg;
|
||||
FExceptionDialotType: TApplicationExceptionDlg;
|
||||
FHelpFile: string;
|
||||
FHint: string;
|
||||
FHintColor: TColor;
|
||||
@ -1592,6 +1601,7 @@ type
|
||||
FOnQueryEndSession : TQueryEndSessionEvent;
|
||||
FOnMinimize : TNotifyEvent;
|
||||
FOnRestore : TNotifyEvent;
|
||||
procedure SetExceptionDialog(AValue: TApplicationExceptionDlg);
|
||||
protected
|
||||
procedure SetCaptureExceptions(const AValue : boolean);
|
||||
procedure SetHelpFile(const AValue : string);
|
||||
@ -1630,6 +1640,8 @@ type
|
||||
published
|
||||
property CaptureExceptions: boolean read FCaptureExceptions
|
||||
write SetCaptureExceptions default True;
|
||||
property ExceptionDialog: TApplicationExceptionDlg read FExceptionDialotType
|
||||
write SetExceptionDialog default aedOkCancelDialog;
|
||||
property HelpFile: string read FHelpFile write SetHelpFile;
|
||||
property Hint: string read FHint write SetHint;
|
||||
property HintColor: TColor read FHintColor write SetHintColor default DefHintColor;
|
||||
|
@ -85,6 +85,7 @@ var
|
||||
begin
|
||||
LCLProc.SendApplicationMessageFunction:=@SendApplicationMsg;
|
||||
|
||||
FExceptionDialog := aedOkCancelDialog;
|
||||
FShowButtonGlyphs := sbgAlways;
|
||||
FShowMenuGlyphs := sbgAlways;
|
||||
FMainForm := nil;
|
||||
@ -1554,10 +1555,15 @@ begin
|
||||
begin
|
||||
DisableIdleHandler;
|
||||
try
|
||||
MsgResult:=MessageBox(PChar(
|
||||
Format(rsPressOkToIgnoreAndRiskDataCorruptionPressCancelToK,
|
||||
[Msg, LineEnding+LineEnding, LineEnding])),
|
||||
PChar(GetTitle), MB_OKCANCEL + MB_ICONERROR);
|
||||
if ExceptionDialog=aedOkMessageBox then
|
||||
begin
|
||||
MsgResult := mrOk;
|
||||
MessageBox(PChar(msg), PChar(GetTitle), MB_OK + MB_ICONERROR);
|
||||
end else
|
||||
MsgResult:=MessageBox(PChar(
|
||||
Format(rsPressOkToIgnoreAndRiskDataCorruptionPressCancelToK,
|
||||
[Msg, LineEnding+LineEnding, LineEnding])),
|
||||
PChar(GetTitle), MB_OKCANCEL + MB_ICONERROR);
|
||||
finally
|
||||
EnableIdleHandler;
|
||||
end;
|
||||
|
@ -66,6 +66,15 @@ begin
|
||||
Application.AddOnDeactivateHandler(FOnDeactivate);
|
||||
end;
|
||||
|
||||
procedure TApplicationProperties.SetExceptionDialog(
|
||||
AValue: TApplicationExceptionDlg);
|
||||
begin
|
||||
if FExceptionDialotType=AValue then
|
||||
Exit;
|
||||
if not (csDesigning in ComponentState) then
|
||||
Application.ExceptionDialog := AValue;
|
||||
end;
|
||||
|
||||
procedure TApplicationProperties.SetCaptureExceptions(const AValue : boolean);
|
||||
begin
|
||||
FCaptureExceptions := AValue;
|
||||
|
Loading…
Reference in New Issue
Block a user