
Home |
|
PegPrompt
|

Examples |

Index |
|
|
|
 |
|
Overview |
Derived from class
PegThing
and PegTextThing
|
 |
|
The PegPrompt class provides a text display object.
A PegPrompt object can be drawn with several different border styles.
It can be updated dynamically to provide real-time display of information.
A PegPrompt object does not support text editing.
A PegPrompt object will, by default,
send PSF_CLICKED signals to its parent object
if the prompt ID is non-zero.
By default, PegPrompt objects cannot be selected and do
not send signals.
The PegPrompt can also
be used to populate PegComboBox and PegList objects.
The font used by a PegPrompt object can be changed
at any time using the SetFont() function, a PegTextThing
member function. The color used by a PegPrompt object
can be set using the SetColor() function.
|
|
PegString
PegVPrompt
The PegPrompt class supports
the following style flags:
FF_NONE | No frame. |
FF_THIN | Thin frame. |
FF_THICK | Thick 3D frame. |
FF_RAISED | Raised 3D frame. |
FF_RECESSED | Recessed 3D frame. |
TJ_RIGHT | Right justify text. |
TJ_LEFT | Left justify text. |
TJ_CENTER | Center text. |
TT_COPY |
Keep separate copy of text with the object.
This flag should be used when the string value used to assign text to an object
is located in temporary storage such as a local variable on the stack. |
AF_ENABLED |
This style flag is used to indicate that the object can be selected. |
AF_TRANSPARENT |
If this style flag is set, the object will be drawn with a transparent
background in its client area. The object therefore floats over its parent,
assuming its parent's image as its background. This style flag is used
by the PegPrompt and PegVPrompt objects to add
text over other control objects. |
The PegPrompt class generates
the following signals:
PSF_CLICKED | Sent by any object when it is selected. |
PSF_FOCUS_RECEIVED | Sent when the object receives input focus. |
Constructors:
 |
 |
PegPrompt(const PegRect &Rect,
|
| |

const PEGCHAR *Text, WORD wId = 0,
|
| |

WORD wStyle = FF_NONE|TJ_LEFT|AF_TRANSPARENT)
|
This constructor creates a
PegPrompt object at a specific location within a
rectangle specified by parameter Rect.
 |
 |
PegPrompt(SIGNED iLeft, SIGNED iTop,
|
| |

SIGNED iWidth, const PEGCHAR *Text,
|
| |

WORD wId = 0,
|
| |

WORD wStyle = FF_NONE|TJ_LEFT|AF_TRANSPARENT,
|
| |

PegFont *pFont = NULL)
|
This constructor creates a
PegPrompt object of width iWidth with its
top left corner located at (iLeft,iTop).
The font used to display the text string can be set to that
specified by parameter pFont. If pFont
is NULL, the text will be rendered in the default prompt font.
The object automatically adjusts its height to accommodate the
font used to display the text string.
 |
 |
PegPrompt(SIGNED iLeft, SIGNED iTop,
|
| |

const PEGCHAR *Text, WORD wId = 0,
|
| |

WORD wStyle = FF_NONE|TJ_LEFT|AF_TRANSPARENT,
|
| |

PegFont *pFont = NULL)
|
This constructor creates a
PegPrompt object with its
top left corner located at (iLeft,iTop).
The font used to display the text string can be set to that
specified by parameter pFont. If pFont
is NULL, the text will be rendered in the default prompt font.
The object automatically adjusts its width and height
according to the dimensions of the rendered text string.
Public Functions:
 |
 |
virtual void DataSet(const PEGCHAR *Text)
|
The PegPrompt class overrides
the DataSet() function to permit the installation of
a new prompt text string. The prompt client area is invalidated.
 |
 |
virtual void Draw(void)
|
The PegPrompt class overrides
the Draw() function to display the prompt text.
 |
 |
virtual SIGNED Message(const PegMessage &Mesg)
|
PegPrompt catches
PM_LBUTTONUP messages.
 |
 |
virtual void SetFont(PegFont *pFont)
|
The PegPrompt class overrides
the SetFont() function to invalidate the
prompt client area when the font is altered to that specified by
parameter pFont.
The following example illustrates several different styles of
PegPrompt objects.

The following code fragment 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, "A Custom Font");
pPrompt->SetFont(&CustomFont);
Add(pPrompt);
}