Applies to
Declaration
procedure InputString(const Text: WideString; CharAttrIndex: Integer);
Description
Inserts a string at cursor position
Parameters |
Text |
The text to be inserted |
CharAttrIndex |
-1 to insert the text neutral, without any character attributes 0 to use current writing mode (=InputText) >0 to use the specified CharacterAttr index. |
Tip:
To read the character at the current position use
Memo.CurrPar.GetChar(Memo.TextCursor.CPPosInPar)
Example:
// We need this interfaces for text creation
IWPMemo Memo = WPDLLInt1.Memo;
IWPTextCursor TextCursor = Memo.TextCursor;
IWPAttrInterface AttrHelper = WPDLLInt1.AttrHelper;
// Calculate a character style index value
AttrHelper.Clear();
AttrHelper.SetFontface("Times New Roman");
AttrHelper.SetFontSize(11);
AttrHelper.IncludeStyles(2); // Italic
int mycharattr = AttrHelper.CharAttrIndex;
// and insert some text
TextCursor.InputString("Hello World", mycharattr);