Home |
Class PegPrompt HMI (Human-Machine Interface) Classes |
Class PegPromptPegPrompt is a text display object. PegPrompt can be drawn with several different border styles, and can be updated dynamically for interactive updates or real-time information display. PegPrompt does not support user-editing. PegPrompt will by default send PSF_CLICKED signals to their parent objects if the prompt Id is non-zero. By default PegPrompt objects cannot be selected, and do not send signals. PegPrompt can also be used to populate PegComboBox and PegList objects. The font used by PegPrompt can be changed at any time by using the SetFont() function, which is a PegTextThing member function. Likewise, the color used by PegPrompt can be set at any time by calling the SetColor() function. class PegPrompt : public PegThing, public PegTextThing { public: PegPrompt(const PegRect &Rect, const PEGCHAR * Text, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE | TJ_LEFT | AF_TRANSPARENT); PegPrompt(int iLeft, int iTop, int iWidth, const PEGCHAR * Text, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE | TJ_LEFT | AF_TRANSPARENT, PegFont * pFont = NULL); PegPrompt(int iLeft, int iTop, const PEGCHAR * Text, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE | TJ_LEFT | AF_TRANSPARENT, PegFont * pFont = NULL); PEGINT Message(const PegMessage &Mesg); virtual void Draw(void); virtual void DataSet(const PEGCHAR * Text); virtual void SetFont(PegFont * Font); }; Demo programs Robot, Table, PegDemo, Notebook, and Dialog use this class. Style FlagsFF_NONE, FF_THIN, FF_RAISED, FF_RECESSED, TJ_RIGHT, TJ_LEFT, TJ_CENTER, TT_COPY, AF_TRANSPARENT, AF_ENABLED. ConstructorsThere are three PegPrompt constructors. The first allows you to fully specify the PegPrompt position and size. The second and third automatically determine the prompt height based on the font passed in to the constructor or the default font prompt if no font is passed. The second constructor allows you to specify the overall prompt width, while using the third constructor allows the prompt to calculate the minimum width required to display the specified text in the specified font. Method DrawPegPrompt overrides the Draw() function to display the prompt text. Method DataSetPegPrompt overrides the dataset function to invalidate the prompt client area. Method MessagePegPrompt catches PM_LBUTTONUP messages. Method SetFontPegPrompt overrides the SetFont function to invalidate the prompt client area. ExamplesThe following are each different styles of PegPrompt: The following function creates a PegPrompt object with a custom font: extern PegFont CustomFont; void MyWindow::AddCustomPrompt(void) { PegRect ChildRect; ChildRect.Set(0, 0, 100, 40); PegPrompt * pPrompt = new PegPrompt(ChildRect, "FooBar"); pPrompt->SetFont(&CustomFont); Add(pPrompt); }
|