Home |
Class PegDialog HMI (Human-Machine Interface) Classes |
Class PegDialogPegDialog is a PegDecoratedWindow class with added features to support modal and non-modal dialog window execution. Dialog windows usually draw themselves with a different frame and client color than other windows. Dialog windows may be executed as modal windows by calling their member function Execute(). Dialog windows attach special significance to buttons with the following IDs:
These button Ids are reserved by PEG, and are found in the header file pegtypes.hpp. When a button with one of the above ID values is selected, the dialog will close. When defining a dialog window, you must insure that at least one button added to the dialog is constructed with one of the above button ID values, otherwise the only way to close the dialog will be via program intervention. When any of the buttons listed above is selected, the dialog window will send a PM_DIALOG_NOTIFY message to its parent window (or its "ReportTo" window) to indicate that the dialog has been completed. The message iData member will contain the ID of the button that caused the dialog to close. In all cases except PM_DIALOG_APPLY, the dialog will close after the parent window has received the PM_DIALOG_NOTIFY message. In the case of a modal dialog, Execute() will return when any of these messages are received, and the return value will be the ID of the button that caused the dialog to close. In the case the user selects the IDB_APPLY button, the dialog will send the PM_DIALOG_NOTIFY message to its parent without closing. class PegDialog : public PegDecoratedWindow { public: PegDialog(const PegRect &Rect, const PEGCHAR * Title = NULL, PegThing * ReportTo = NULL, PEGUINT wStyle = FF_RAISED); PegDialog(const PEGCHAR * Title = NULL, PegThing * ReportTo = NULL, PEGUINT wStyle = FF_RAISED); virtual PEGINT Message(const PegMessage &Mesg); protected: PegThing * mpReportTo; }; Demo program PegDemo uses this class. Style FlagsFF_NONE, FF_THIN, FF_RAISED, FF_RECESSED, FF_THICK. ConstructorsThe first constructor defines the window size and position at the time the window is created. The second requires that the window size and position be determined after the window is constructed, but before the window is displayed. Method MessagePegDialog overrides the Message() function to catch signals sent by one of or more of the reserved button IDs that cause the dialog to close or report to its owner window. ExampleThe following is a PegDialog window. The full source code for this window can be found in the file Pegdemo.cpp.
|