
To get the current selection in the control to replace the selected text or (if nothing is selected) to insert itself at the current caret location, use the following code:
void SECEditView::InsertText(LPCTSTR strText)
{
SECEditController* pCtrl = GetSECEditController();
ASSERT(pCtrl != NULL);
SECEditLineCol lcCaret = pCtrl->GetCaretPos();
GetEditModel()->Insert(lcCaret.line, lcCaret.col, strText);
}
|
Add a pCtrl->Clear() call right before the GetCaretPos() function so that any selected text will be removed before the new text is inserted.
The only indention feature Objective Edit supports is AutoIndent, which allows the new line (when you hit the <Enter> key) to start with the same amount of white space as the previous line.
To enable this feature, call:
GetEdit()->GetLangPtr()->SetAutoIndent(TRUE); |
To disable it, call:
GetEdit()->GetLangPtr()->SetAutoIndent(FALSE); |
Objective Edit now provides a way to color highlight a line. Highlighting a line is very similar to adding a bookmark in that it acts by adding the data flag ID_SECEDIT_ITEMDATA_HIGHLIGHT to the line. You also need to define a color group for highlighting in the .ini file. Here is an example:
[Highlight] Foreground = 255,255,255 Background = 128,0,0 DisplayName = Highlight |
This color group only needs three lines:
Foreground defines the foreground color of the highlighted line.
Background defines the background color of the highlighted line.
DisplayName has to be "Highlight" in order to be recognized by SECEditLangConfig.
A new command ID has been added for toggling the highlight flag: ID_SECEDIT_HIGHLIGHT_TOGGLE
A regular expression is a pattern of text characters (such as the letters a through z, or special characters such as *) that describes a string to match when performing a search of text.
Objective Edit's Find/Replace Dialog uses VBScript's Regular Expression (RegExp) object, which provides simple regular expression support.
In the function BOOL SECEditRegExp::Create(), the CreateDispatch(_T("VBScript.RegExp")) method serves as a connection to VBScript regular expressions. (In VBScript, the regular expression engine was implemented as a COM object so it could be called from sources outside VBScript.)
Search MSDN (http://msdn.microsoft.com/library/) for details on the VBScript RegExp object.
As discussed in Section 1.2.1.4, "HTML Output," Objective Edit depends on the Regex++ (regular expression) libraries. However, Regex++ is used for HTML output only--not the Find and Replace functionality.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.