-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUGerais.pas
71 lines (61 loc) · 1.57 KB
/
UGerais.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
unit UGerais;
interface
uses
Classes,
Controls,
Dialogs,
Forms,
Graphics,
sBitBtn,
Variants,
Windows;
type
TUnt_Gerais = class
private
{ Private declarations }
public
{ Public declarations }
class function MsgQuestion(msg: string): boolean; static;
class procedure DesabilitaBotoes(qtdItens: integer; btn_Editar, btn_Remover: TsBitBtn); static;
class procedure MsgInformation(msg: string); static;
class procedure MsgWarning(msg: string); static;
class procedure OpenForm(const Classe: TFormClass); static;
end;
implementation
class function TUnt_Gerais.MsgQuestion(msg: string): boolean;
begin
Result := False;
if (MessageBox(0, PAnsiChar(msg), PAnsiChar(Application.Title), MB_ICONQUESTION or MB_YESNO) = idYes) then
Result := True;
end;
class procedure TUnt_Gerais.DesabilitaBotoes(qtdItens: integer; btn_Editar, btn_Remover: TsBitBtn);
begin
if (qtdItens > 0) then
begin
btn_Editar.Enabled := True;
btn_Remover.Enabled := True;
end
else
begin
btn_Editar.Enabled := False;
btn_Remover.Enabled := False;
end;
end;
class procedure TUnt_Gerais.MsgInformation(msg: string);
begin
MessageBox(0, PAnsiChar(msg), PAnsiChar(Application.Title), MB_ICONINFORMATION or MB_OK);
end;
class procedure TUnt_Gerais.MsgWarning(msg: string);
begin
MessageBox(0, PAnsiChar(msg), PAnsiChar(Application.Title), MB_ICONWARNING or MB_OK);
end;
class procedure TUnt_Gerais.OpenForm(const Classe: TFormClass);
begin
with Classe.Create(Application) do
try
ShowModal;
finally
Free;
end;
end;
end.