-
Notifications
You must be signed in to change notification settings - Fork 19
/
FormAsyncMessage.pas
80 lines (60 loc) · 2.27 KB
/
FormAsyncMessage.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
UNIT FormAsyncMessage;
{=============================================================================================================
Gabriel Moraru
2024.05
See Copyright.txt
--------------------------------------------------------------------------------------------------------------
A non-blocking message box.
No dependences.
=============================================================================================================}
INTERFACE
{.$DENYPACKAGEUNIT ON} {Prevents unit from being placed in a package. https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Packages_(Delphi)#Naming_packages }
USES
System.Classes, Vcl.Forms, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Controls;
type
TfrmShowMsgAsync = class(TForm)
lblMessage: TLabel;
Panel1: TPanel;
btnOK: TButton;
procedure btnOKClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
public
end;
procedure MesajAsync (CONST Msg: string; CONST Caption: string= ''; PopupParent: TCustomForm= NIL);
procedure MesajInfoAsync (CONST Msg: string; PopupParent: TCustomForm= NIL);
procedure MesajWarnAsync (CONST Msg: string; PopupParent: TCustomForm= NIL);
procedure MesajErrorAsync(CONST Msg: string; PopupParent: TCustomForm= NIL);
IMPLEMENTATION {$R *.dfm}
procedure MesajAsync(CONST Msg: string; CONST Caption: string= ''; PopupParent: TCustomForm= NIL);
VAR frm: TfrmShowMsgAsync;
begin
frm:= TfrmShowMsgAsync.Create(Application.MainForm);
frm.Caption:= Caption;
frm.lblMessage.Caption:= Msg;
frm.BorderStyle:= bsDialog;
frm.PopupParent:= PopupParent;
frm.Show;
end;
procedure MesajInfoAsync(CONST Msg: string; PopupParent: TCustomForm= NIL);
begin
MesajAsync(Msg, 'Info', PopupParent);
end;
procedure MesajWarnAsync(CONST Msg: string; PopupParent: TCustomForm= NIL);
begin
MesajAsync(Msg, 'Warning', PopupParent);
end;
procedure MesajErrorAsync(CONST Msg: string; PopupParent: TCustomForm= NIL);
begin
MesajAsync(Msg, 'Error', PopupParent);
end;
procedure TfrmShowMsgAsync.btnOKClick(Sender: TObject);
begin
Close;
end;
procedure TfrmShowMsgAsync.FormClose(Sender: TObject; var Action: TCloseAction);
begin
// WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!
Action:= caFree;
{Action:= caFree; Delphi bug: https://quality.embarcadero.com/browse/RSP-33140 }
end;
end.