Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
A dialog posing a question that can be answered by yes/no/cancel/etc.
To use MessageDlg , #include the header file dialogs.hpp.
MessageDlg("You want me to give you this message?", //Message
mtConfirmation, //Message type
TMsgDlgButtons() << mbYes << mbNo, //Buttons
0); //Help Context
const int returnValue = MessageDlg(AnsiString Msg, //Message
TMsgDlgType DlgType, //Message type
TMsgDlgButtons Buttons, //Buttons
int HelpCtx); //Help context
Possible return values are:
mrOK, mrCancel, mrYes, mrNo, mrAbort, mrRetry, mrIgnore
Possible message dialog types are:
enum TMsgDlgType {
mtWarning,
mtError,
mtInformation,
mtConfirmation,
myCustom
};
Possible buttons are:
enum TMsgDlgBtn {
mbYes,
mbNo,
mbOK,
mbCancel,
mbAbort,
mbRetry,
mbIgnore,
mbAll,
mbNoToAll,
mbYesToAll,
mbHelp
};
Because TMsgDlgButtons is a set, you use it e.g. by:
TMsgDlgButtons() << mbYes << mbNo; //Etcetera
* ShowMessage: the VCL equivalent of std::cout
* MessageDlg: A yes/no/cancel/etc. dialog box.
* InputBox: Ask the user for a value
* InputQuery: Ask the user for a value