1. Computing
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

CreateMessageDialog

unit
Dialogs
category
Dialog and Message routines

declaration
type TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);
type TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp);
type TMsgDlgButtons = set of TMsgDlgBtn;

function CreateMessageDialog(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons): TForm;

description
Returns a specified message dialog, does not display the dialog form.

Use CreateMessageDialog to create a message dialog that will be used several times in an application.
CreateMessageDialog does not show the created dialog form. The application must display this form when it is needed by calling its ShowModal method.

example
//could be global variable - declared in 
//the interface section of some unit
var myDLG : TForm;  

 //in MainForm OnCreate
 myDLG := CreateMessageDialog('This is a shareware warning!', mtWarning, [mbOk]);

 //several times "anywhere" - in any handler needed 
 myDLG.ShowModal;
 
 //in MainForm OnDestroy
 myLDG.Release; 


in real code
Working with dialogs
A set of articles and tips to help you learn working with common dialog boxes and extend your knowledge on advanced dialog usage.

see also
ShowMessage, ShowMessageFmt,


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

©2014 About.com. All rights reserved.