Sunday 28 April 2019

4 Tricks / How to Display Messages / Message Boxes at Delphi


Usually, if we want to exit Form on Delphi, there is a dialog box containing the message that we want to convey, either in the form of the Yes, No, Cancel, Abort, or message name of the creator of the program. Here's how.

First.

        Showmessage('Syaharuddin');
close;

Second.

       
if messagedlg('Yakin Anda Ingin Keluar...?',mtconfirmation,[mbYes]+[mbNo],0)=mrYes then begin
close;
end;
end;
     
If you want to add Cancel or something else, you can edit it in this section in bold. For example, want to add Cancel, then:

if messagedlg('Yakin Anda Ingin Keluar...?',mtconfirmation,[mbYes]+[mbNo]+[mbCancel],0)=mrYes then begin
close;
end;
end;

Third.


       This message box consists of two lines.

if messageDlg ('Yakin Anda Ingin Keluar ...?'+chr(10)+' '+ 'Programer:Syaharuddin', mtInformation,  [mbYes]+[mbNo],0) = mrYes then begin
application.terminate;
end;

Fourth.

        Combined one and two.
       
Showmessage('Syaharuddin');
if messagedlg('Yakin Anda Ingin Keluar...?', mtconfirmation,[mbYes]+[mbNo],0)= mrYes then begin
Application.Terminate;
end;

You can combine with each other, as needed. May be useful.

No comments:
Write komentar

Syaharuddin. Theme images by MichaelJay. Powered by Blogger.

KOMENTAR ANDA