Jump to content
c0smyn

[Borland Delphi] Folosirea mesajelor intr-un mod mult mai simplu

Recommended Posts

Un mod mult mai simplu pentru a folosi sistemul de mesaje in Borland Delphi

Puneti acest cod sub " {$R *.dfm} "


procedure ArataMesaj(mesaj: string; titlu: string; tip: Integer);
var
eroare,informatie,exclamatie,intrebare,normal: boolean;
begin
if tip > 5 then exit
else
if tip < 1 then exit;

eroare := false;
informatie := false;
exclamatie := false;
normal := false;
intrebare := false;

{Setare tip mesaj} //begin
if tip = 1 then eroare := true;
if tip = 2 then informatie := true;
if tip = 3 then exclamatie := true;
if tip = 4 then normal := true;
if tip = 5 then intrebare := true;
{Setare tip mesaj} //end;

if eroare = true then
MessageBox(application.handle,Pchar(mesaj),Pchar(titlu), +mb_OK +mb_ICONERROR)
else
if informatie = true then
MessageBox(application.handle,Pchar(mesaj),Pchar(titlu), +mb_OK +mb_ICONINFORMATION)
else
if exclamatie = true then
MessageBox(application.handle,Pchar(mesaj),Pchar(titlu), +mb_OK +mb_ICONEXCLAMATION)
else
if normal = true then
MessageBox(application.handle,Pchar(mesaj),Pchar(titlu), +mb_OK)
else
if intrebare = true then
MessageBox(application.handle,Pchar(mesaj),Pchar(titlu), +mb_OK +mb_ICONQUESTION);
end;

Noua comanda va fi ArataMesaj(string,string,integer);

Exemplu:


ArataMesaj('Nu imi place scoala!','Rst Center',2);

"Nu imi place scoala" - reprezinta mesajul care v`a fi afisat

"Rst Center" - reprezinta titlul mesajului

"2" - reprezinta tipul de mesaj (2 = mesaj de tip informatie)

Tipurile de mesaj:

1 - Mesaj eroare

2 - Mesaj informatie

3 - Mesaj exclamatie

4 - Mesaj normal

5 - Mesaj intrebare

Enjoy ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...