Home |
Class PegMessageWindow HMI (Human-Machine Interface) Classes |
Class PegMessageWindowPegMessageWindow is a popup window class for display warning, error, or other status information to the user. PegMessageWindow is 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. class PegMessageWindow : public PegWindow, public PegTextThing { public: PegMessageWindow(const PegRect &Rect, const PEGCHAR * Title, const PEGCHAR * Message = NULL, PEGUINT wStyle = MW_OK | FF_RAISED, PegBitmap * pIcon = NULL, PegThing * Owner = NULL); PegMessageWindow(const PEGCHAR * Title, const PEGCHAR * Message = NULL, PEGUINT wStyle = MW_OK | FF_RAISED, PegBitmap * pIcon = NULL, PegThing * Owner = NULL); virtual void Draw(void); virtual PEGINT Message(const PegMessage &Mesg); }; Demo programs PegDemo, Table, and Spread use this class. Style FlagsFF_NONE, FF_THIN, FF_RAISED, FF_RECESSED, FF_THICK, MW_OK, MW_YES, MW_ABORT, MW_RETRY, MW_CANCEL. ConstructorsThe first constructor allows you to specify the overall message window size. This constructor is used in cases where you would like to add additional decorations to the message window. When the second constructor is used, the message window calculates the required height and width of the window in order to fit the message text and all specified option buttons. The second constructor is most commonly used. The pIcon parameter allows you to specify a bitmap that will be displayed to the left of the text message. The Owner pointer allows you to specify a window that should receive a PM_MWCOMPLETE message. This is only useful when the message window is not executed modally. When the window is executed modally, the Execute() function returns the ID of the button used to close the message window. Method DrawPegMessageWindow overrides the Draw() function to display the message text in the window client area. Method MessagePegMessageWindow catches option button signals to close the message window. ExamplesThe following is a PegMessageWindow with OK, CANCEL, and RETRY buttons. The following function creates and modally executes the above message window: void MyWindow::ModalMessage(void) { PegMessageWindow * pWin = new PegMessageWindow("Example Message Window", "This is a message window with a raised frame.", MW_OK | MW_CANCEL | MW_RETRY | FF_RAISED); Presentation()->Center(pWin); Presentation()->Add(pWin); pWin->Execute(); }
|