-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfrmNewMsgDlg.pas
79 lines (65 loc) · 1.7 KB
/
frmNewMsgDlg.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
unit frmNewMsgDlg;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Vcl.Buttons;
type
TfrmNewMessageDlg = class(TForm)
imgDlgIcon: TImage;
lblGrab: TLabel;
lblMessage: TLabel;
btnOK: TBitBtn;
btnCancel: TBitBtn;
procedure rzDlgButtonsClickOk(Sender: TObject);
procedure rzDlgButtonsClick(Sender: TObject);
public
procedure SetIcon(NewIcon: Integer);
procedure SetMessage(NewMsg: PChar);
end;
var
frmNewMessageDlg: TfrmNewMessageDlg;
implementation
{$R *.DFM}
const
mtWarning = 0;
mtError = 1;
mtInformation = 2;
mtConfirmation = 3;
procedure TfrmNewMessageDlg.rzDlgButtonsClickOk(Sender: TObject);
begin
ModalResult := mrOk;
end;
procedure TfrmNewMessageDlg.rzDlgButtonsClick(Sender: TObject);
begin
ModalResult := mrCancel;
end;
procedure TfrmNewMessageDlg.SetIcon(NewIcon: Integer);
begin
case NewIcon of
mtWarning:
begin
lblGrab.Caption := 'Hey Dude, Watch out!';
imgDlgIcon.Picture.Bitmap.LoadFromResourceName(HInstance, 'IconWarn');
end;
mtError:
begin
lblGrab.Caption := 'Whoa! Now THAT''S an error!';
imgDlgIcon.Picture.Bitmap.LoadFromResourceName(HInstance, 'IconError');
end;
mtInformation:
begin
lblGrab.Caption := 'Here''s something to chew on.';
imgDlgIcon.Picture.Bitmap.LoadFromResourceName(HInstance, 'IconInfo');
end;
mtConfirmation:
begin
lblGrab.Caption := 'Be sure. Be VERY sure.';
imgDlgIcon.Picture.Bitmap.LoadFromResourceName(HInstance, 'IconConfirm');
end;
end;
end;
procedure TfrmNewMessageDlg.SetMessage(NewMsg: PChar);
begin
lblMessage.Caption := StrPas(NewMsg);
end;
end.