The PegMessageWindow class provides a quick way to display information messages.
PegMessageWindow may contain a title bar, message line, and miscellaneous buttons.
PegMessageWindow supports both modal and non-modal execution. In addition, the
signal generated when the MessageWindow is closed by the user may be directed to any
top-level window.
Modal execution is achieved by calling the MessageWindow Execute() function.
Execute() will add the MessageWindow to PegPresentationManager if the window has
no parent at the time Execute() is called. Execute() will not return until the user selects
one of the MessageWindow option buttons. Execute() will return the ID of the option
button selected to close the MessageWindow.
Several button ID values are reserved by PEG for use with PegMessageWindow (and
PegDialog). These ID values correlate to the common options presented on a message
window. Additional options may be presented by deriving from and extending the
PegMessageWindow class. The buttons included on the message window are specified by
the message window style flags. There is one style flag for each of the pre-defined
message window buttons.
Here is a simple example of creating a PegMessageWindow:
void MyWindow::ModalMessage(void)
{
PegMessageWindow *pWin = new PegMessageWindow("Message Window",
"This is a message window.", MW_OK|MW_CANCEL|MW_RETRY);
Add(pWin);
pWin->Execute();
}
For the most part PegMessageWindow assumes that your error message will fit on one
line. If you need line-wrapping you should use the following constructor:
PegMessageWindow(const PEGCHAR *Title, const PEGCHAR *Message,
50