How to make text between 2 of the same characters become underlined?
Deleting should be taken into effect. For example say the char I wanted to look for is Chr(3) where Chr is Delphi's function.
The first one is the starting char and the second one is the matching. Think of it like HTML's bold tag only there's no distinction in the closing tag.
So you have
Chr(3) some text Chr(3) some more text
Then you'd get the following
Chr(3) some text Chr(3) some more text
If you deleted the closing tag then you should have
Chr(3) some text some more text
If you deleted the start tag then the closing tag becomes a start tag
some text Chr(3) some more text
Hope this is clear enough.
How To Accomplish The Following...
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
This is quite a complicated logic, there are no methods to make it simple.
General direction - in OnChange, use SearchText (or other method) to find the character, then use SetSelectionBounds, ApplyStyleConversion, InsertText.
Similar work is performed in the simple RichViewEdit-based syntax highlighter, see http://www.trichview.com/resources/
General direction - in OnChange, use SearchText (or other method) to find the character, then use SetSelectionBounds, ApplyStyleConversion, InsertText.
Similar work is performed in the simple RichViewEdit-based syntax highlighter, see http://www.trichview.com/resources/
Ok I've tried this but no luck.
In OnChange, I store the old cursor position and then move the cursor position to the beginning. But what happens is that the the new text that fires OnChange, is being entered at position 0 instead of where the cursor position was original.
Also restoring the old cursor position isn't working for me. Can you provide some code, thanks.
In OnChange, I store the old cursor position and then move the cursor position to the beginning. But what happens is that the the new text that fires OnChange, is being entered at position 0 instead of where the cursor position was original.
Also restoring the old cursor position isn't working for me. Can you provide some code, thanks.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
May be you call Format somewhere, and it resets the caret position to the beginning?
It's better to use functions from RVLinear.pas to store and restore the selection.
function RVGetLinearCaretPos(rve: TCustomRichViewEdit): Integer;
procedure RVSetLinearCaretPos(rve: TCustomRichViewEdit; LinearPos: Integer);
procedure RVGetSelection(rv: TCustomRichView; var SelStart, SelLength: Integer);
procedure RVSetSelection(rv: TCustomRichView; SelStart, SelLength: Integer);
It's better to use functions from RVLinear.pas to store and restore the selection.
function RVGetLinearCaretPos(rve: TCustomRichViewEdit): Integer;
procedure RVSetLinearCaretPos(rve: TCustomRichViewEdit; LinearPos: Integer);
procedure RVGetSelection(rv: TCustomRichView; var SelStart, SelLength: Integer);
procedure RVSetSelection(rv: TCustomRichView; SelStart, SelLength: Integer);