| Methods Index |
CViewSubclasses:
NLineText, NTextEdit
CNativeTextEdit is the abstract text editing class that provides functionality for native text edit boxes. The CNativeTextEdit branch of CView represents text edit objects, allowing the user to display text inside views, type in text, and perform the usual cut, paste, and copy operations. All CNativeTextEdit objects inherit the properties of CView, such as sizing, dragging, and so on. As an abstract class, CNativeTextEdit represents a rectangular text edit area on the screen and provides basic text manipulation methods. There is no concept of lines, paragraphs, or scrolling at this level. These text properties are embodied in the various classes that are derived from CNativeTextEdit, classes that represent the different types of text editing systems available in XVT-Power++.
NLineText or NTextEdit.
|
|
|
|
BOOLEAN
|
itAutoSelects;
| Whether there is auto selection |
static WINDOW
|
itsUpdateWindow;
| The window needs updating |
virtual ~CNativeTextEdit(void);
BOOLEAN INativeTextEdit(unsignedtheAttributes = TX_BORDER,
UNITS theRightMargin = 1000,
int theCharactedLimit = 1000,
const CStringRW theInitialText = NULLString,
BOOLEAN isAutoSelected = FALSE,
BOOLEAN isVisible = TRUE,
GLUETYPE theGlue = NULLSTICKY);
theAttributes are shown in Table 10.
theRightMargin is a pixel measurement of the right margin, starting from the left side and beginning at zero (0). In addition, there is a parameter that sets the default character limit at 1,000 characters. theInitialText is a string containing any text you may wish to initialize with the text edit system. If the isAutoSelected parameter is set to TRUE, all of the text in the text edit box becomes selected when the user clicks inside the box. Finally, this initializer, like the initializers of all CView classes, takes a visibility state and a glue type.
virtual void SetText(const CStringRW& theText);
SetText sets the text for the text edit box. Any text already inside the box is replaced. This method sets the text to be exactly what is passed in.
virtual BOOLEAN Append(const CStringRW& theText);
Append appends this string to whatever text is already inside a text edit object. This method returns a BOOLEAN value of TRUE if the append operation succeeds.
virtual CStringRW GetText(void) const;
virtual T_CNUM GetNCharInText(void) const;
virtual void SelectText(void);
virtual CStringRW GetSelectedText(void) const;
GetText, except that is applies to selected text. That is, it returns a string containing all selected text in the edit box.
virtual T_CNUM GetNCharInSelection(void) const;
virtual BOOLEAN Clear(void);
virtual BOOLEAN IsEmpty(void) const;
BOOLEAN value indicating whether a text box contains any text.
virtual void SetAttribute(
unsigned theAttribute,BOOLEAN isSet=TRUE);
BOOLEAN value indicating whether to turn this attribute on or off. For further information about XVT Portability Toolkit attributes, see the initializer method INativeTextEdit. Also, see the text editing chapter of the XVT Portability Toolkit Guide.
virtual unsigned long GetAttributes(void) const;
virtual void SetLimit(int theCharacterLimit);
TX_ONEPAR attribute is set. This method sets the limit on the number of characters the paragraph, and therefore the entire text box, can contain. If you set a new limit and the text box already contains more characters than the newly set limit, the text is not truncated. For example, if you set a new limit of 400 characters for a text box that already contains 600 characters, then the 600 characters remain. However, no more text can be entered into the box.
virtual int GetLimit(void) const;
virtual void SetMargin(UNITS theRightMargin);
theRightMargin is a pixel measurement of the right margin, starting from the left side and beginning at zero (0). If the text edit object has a horizontal scrollbar, this method resets the scrollbar's range according to the new margin.
virtual UNITS GetMargin(void) const;
virtual void Reset(void);
virtual void Suspend(void);
Resume, next.
virtual void Resume(void);
Suspend and Resume. See Suspend, above.
virtual void DoHit(CONTROL_INFO theControlInfo);
DoHit() in response to an E_CONTROL message. These occur for such events as focus change and typing in the text edit.
virtual void SetFocusCommands(
long theKeyFocusCommand,
long theKeyFocusLostCommand);
virtual void SetTextCommand(long theTextCommand);
long GetTextCommand( void ) const;
long GetKeyFocusCommand(void) const;
long GetKeyFocusLostCommand(void) const;
virtual int Validate(int theKey,
BOOLEAN isShiftKey,
BOOLEAN isControlKey);
theKey is the ASCII value for the character key that was pressed; isShiftKey and isControlKey indicate whether the Shift or Control key was pressed in conjunction with the character key.
Validate responds to a keyboard event in one of three ways:
Validate accepts the keyboard event and returns theKey as the ASCII value of the character to be placed in the text edit system.
Validate rejects the keyboard event by returning NULL.
Validate seeks to modify the keyboard event by returning the ASCII value of the character it wishes to pass on to the text edit system.To see how
Validate works, think of implementing a password text box. When the user enters a login name, Validate would behave as in case 1 by permitting the characters being typed to appear on the screen. However, when the user enters a password, Validate may choose to modify the input by returning an asterisk (*) for each event received. In addition, Validate may behave as in case 2, ignoring all tabs by returning NULL.Override this method to implement the kind of text validation described here. By default, this method always returns the exact key that it receives.
virtual void PostValidate();
DoHit() detects a change in text content, it calls PostValidate(). The text edit implementation uses the CValidator associated with the text edit (if any) to perform standard validation of the modified text.
void SetTabSize(int theSize);
int GetTabSize(void) const;
virtual void Key(const CKey& theKey);
thekey represents the character key that was pressed, including whether the Shift or Control key was pressed at the same time. This method calls Validate to allow the user to validate the key before actually passing it on to the text edit system.
virtual void SetOrigin(const CPoint& theDelta);
theDeltaPoint to it. Suppose, for example, that a text box has an origin of 10,20 and you want to shift the origin by three pixels to the right. You set the origin by giving it a delta point of 3,0, which shifts the view three pixels horizontally.
virtual void SetFont(const CFont &theNewFont,
BOOLEAN isUpdate = FALSE);
isUpdate parameter indicates whether this SetFont message is simply an update message or whether it is a "real" SetFont message meaning that the text box should set its own font to the new font.
virtual void Size(const CRect& theNewSize);
theNewSize, like the region that is passed in on creation of a text box, is relative to the enclosure.
virtual void Show(void);
virtual void Hide(void);
virtual void Activate(void);
virtual void Deactivate(void);
virtual void Draw(const CRect& theClippingRegion);
theClippingRegion is the part of the text box that needs to be drawn.
virtual void SetGlue(GLUETYPE theGlue);
NULLSTICKY upon creation. For a listing of valid glue types, see the list under CGlue "Usage".
virtual BOOLEAN ClassCanGetKeyFocus(void) const;
CView::ClassCanGetKeyFocus to return TRUE.
virtual void Disable(void);
virtual void SetEnvironment(const CEnvironment& theNewEnvironment, BOOLEAN isUpdate = FALSE);
theNewEnvironment that is passed to it. By default, text boxes share their enclosure's environment. However, as soon as you use SetEnvironment to give a text box an environment of its own, the text box uses that environment instead of the shared environment.
virtual void DoCommand(long theCommand,
void* theData = NULL);
CView::DoCommand to provide handling for TDI commands.
TXEDIT GetXVTTextEdit(void) const;
CNativeTextEdit(CSubview *theEnclosure,
const CRect& theRegion,
unsigned theAttributes = TX_BORDER,
UNITS theRightMargin = 1000,
int theCharacterLimit = 1000);
theEnclosure is a pointer to the subview that will contain the text box. theRegion is a coordinate location, local to the enclosure, that is used to place the text box. If the text box has a border, which is the default, then the border rectangle is drawn around the CRect. This CRect object is inset by 4 pixels inside the border. The bottom of the CRect may be inset even more to ensure that an integral number of lines will fit into the text box.In addition, this constructor takes an unsigned value pertaining to the XVT Portability Toolkit attributes that the text edit system can have. These attributes can be OR'd and passed in together, as described in the Text Edit section of the "Controls" chapter of the XVT Portability Toolkit Guide. For further information about the XVT Portability Toolkit attributes, see
INativeTextEdit. Finally, this constructor takes a right margin for the text box, which is measured in logical units starting with zero (0) at the left side of the text box, and a limit on the number of characters that can fit into the text box.
CNativeTextEdit(CSubview *theEnclosure);
theEnclosure to the inherited constructor for CView.
CNativeTextEdit(const CNativeTextEdit& theTextEdit);
CNativeTextEdit& operator= (
const CNativeTextEdit& theTextEdit);
CNativeTextEdit.
void CreateTextEdit(void);
void GetTextInternal(T_PNUM theFirstParagraph,
T_PNUM theLastParagraph,
T_LNUM theFirstLine,
T_LNUM theLastLine,
T_CNUM theFirstChar,
T_CNUM theLastChar,
CStringRW theTextBuffer) const;
GetText, but it performs the actual calculations within the text editing system. GetTextInternal takes the numbers of the first and last paragraphs, the numbers of the first and last lines, and the numbers of the first and last characters. Then it appends the text mapped out by these parameters to any text already contained in the given string buffer.
T_CNUM GetNCharInternal(T_PNUM theFirstParagraph,
T_PNUM theLastParagraph,
T_LNUM theFirstLine,
T_LNUM theLastLine,
T_CNUM theFirstChar,
T_CNUM theLastChar) const;
GetNCharInternal takes the numbers of the first and last paragraphs, the numbers of the first and last lines, and the numbers of the first and last characters. Then it counts all the characters in the chunk of text mapped out by these parameters.
void GetFullPar(T_PNUM theParagraph,
CStringRW theText) const;
void GetLineInternal(T_PNUM theParagraph,
T_LNUM theLine, CStringRW theText) const;
void Truncate(CStringRW& theText);
CNativeTextEdit object.
void ResetColors(void);
SetEnvironment.
virtual void UpdateUnits(CUnits* theUnits);
CUnits object indicated by theUnits, which is the CUnits object owned by the CNativeTextEdit object, that is, an object inheriting from CNativeTextEdit. For more information, see CUnits.
virtual void PositionTextEdit(void);
itsFrame.
virtual void DoUpdateModel(long theControllerId,
long theCommand, const CModel* theModel);
CView::DoUpdateModel to provide handling of TDI messages.
void TdiProcessEvent(EVENT* e);
void GetPartLine(T_CNUM theFirstChar,
T_CNUM theLastChar,
T_PNUM theParagraph,
T_LNUM theLineNumber,
CStringRW theText) const;
void GetPartPar(T_CNUM theStartChar,T_CNUM theEndChar,
T_PNUM theParagraph,
T_LNUM theStartLine,
T_LNUM theEndLine,
CStringRW theText) const;
T_CNUM GetNCharInPartPar(T_CNUM theStartChar,
T_CNUM theEndChar,
T_PNUM theParagraph,
T_LNUM theStartLine,
T_LNUM theEndLine) const;