KwikPeg Manuals
Home
PegEditBox
Examples
Examples
Index
Index


Members
Styles
Signals
Overview Derived from class PegTextBox

The PegEditBox class provides a multiline text display with services to support editing of the text using a screen pointer and keyboard. Since the PegEditBox is derived from the PegTextBox class, it supports all of the functionality provided by that base class.

If you do not require the text editing features of the PegEditBox class, you should use a PegTextBox object to display multiline text to minimize your application's code footprint.



 See Also

PegPrompt

PegString

PegWindow

PegTextThing



 Styles

The PegEditBox 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.
EF_EDIT  The text within a PegEditBox or PegString object can be edited by the user. If this style is applied, the object automatically includes the TT_COPY style.
EF_WRAP  Long lines of text in any object derived from a PegTextBox object will be wrapped to prevent them from being clipped.
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.


 Signals

The PegEditBox class generates the following signals:

PSF_TEXT_SELECT Sent when the user selects all or a portion of a text object.
PSF_TEXT_EDIT Sent each time text object string is modified.
PSF_TEXT_EDITDONE Sent when a text object modification is complete.

Top of page


 Members

Constructors:

PegEditBox(const PegRect &Rect,
  WORD wId = 0,
  WORD wStyle = FF_RECESSED|EF_EDIT|EF_WRAP,
  PEGCHAR *Text = NULL,
  WORD wMaxChars = 1000)

This constructor creates a PegEditBox object at a specific location within a rectangle specified by parameter Rect. The rectangle defines the mReal position of the window.

The editbox object ID, window style and initial text can all be specified. Parameter wMaxChars specifies the size of the editbox character array, the maximum number of characters that the editbox can hold.

 

Public Functions:

virtual void Append(PEGCHAR *Text,
  BOOL bDraw = TRUE)

This function appends the indicated text to the current editbox string value. If any appended characters would extend beyond the editbox limit, an equivalent number of characters are deleted from the beginning of the editbox character array.

The edit cursor is automatically postioned at the end of the appended text.

If parameter bDraw is TRUE, the editbox will be redrawn to reflect the newly added text.

void CopyToScratchPad(void)

This function copies the currently selected text from the editbox to the scratch pad.

virtual void DataSet(const PEGCHAR *Text)

The PegEditBox class overrides the DataSet() function to permit the installation of the new text string referenced by Text. Any edit operation which is in progress is terminated. Selected text, if any, is unselected. The editbox client area is invalidated. Line offsets are recalcalculated and the scroll bars, if any, are adjusted if necessary.

void DeleteMarkedText(void)

This function deletes the currently selected text, if any, from the editbox.

virtual void Draw(void)

The PegEditBox class overrides the Draw() function to display the editbox border and text.

void HomeCursor(void)

This function moves the edit cursor to column 0 of the current line of the multiline editbox.

BOOL inEditMode(void)

Returns TRUE if the PegEditBox is in edit mode, else returns FALSE.

void InsertCharAtCursor(WORD iKey)

This function inserts the single character iKey at the cursor position. If the maximum character limit has been reached, the character is not inserted.

virtual SIGNED Message(const PegMessage &Mesg)

The PegEditBox class catches screen pointer and keyboard messages to provide text editing services, single line scrolling and paged scrolling.

void PasteFromScratchPad(void)

This function pastes the content of the scratch pad text buffer at the current cursor position in the editbox.

void SetCursorRowCol(WORD wIndex)

This function positions the edit cursor to the right of the character at offset wIndex within the multiline text string. Offset wIndex is an index into the character array which holds the entire multiline text string.

To find specific characters or substrings within the multiline text array, use the member functions of class PegTextBox. The editbox automatically scrolls, if necessary, so that the cursor is visible within the client area of the PegEditBox object.


Top of page


 Examples

The following example illustrates a PegEditBox object displayed within a PegDecoratedWindow object. The source code for this example is provided in the KPGnnn\EXAMPLES\VECFONT installation directory.




Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003