trichview.com

trichview.support




Re: Insert/Overtype Status


Return to index


Author

Message

Louis Kessler

Posted: 02/11/2003 4:59:30


Making the caret wider could work, except for a few problems:


1. RichViewEditCaretWidth is a constant, so only can have one value. What is

really desired is to have it set to 1 for insert mode, and then to set it to

something like 8 (or maybe to the next character's width) for overwrite mode.

I could make some changes in your code to allow this, but it is not something

that I would want to do.  It would be better if it were part of RichView.


2. The center of the caret is at the left edge of the next character.  If the

caret is wider than 1, then only half of it covers the beginning of the next

character, and the other half covers the end of the previous character.  The

caret's left edge, rather than centre, should be at the left edge of the next

character so that the caret will only cover the next character, not the

previous one.


Louis Kessler

Winnipeg, Manitoba, Canada



Sergey Tkachenko wrote:

> Is character will be selected, some operations will be performed

> inconsistently. For example, Backspace will delete the selected

> character.

>

> As a visual indication, you can for example make caret wider

> assigning 2 to RichViewEditCaretWidth from RVERVData.pas

>

>

>> Sergey:

>>

>> This works, but is there any way to keep that next character

>> selected as a visual indicator to the user that it is the character

>> that will next be overwritten?

>>

>> The selection gets deleted by TCustomRichViewEdit.KeyPress just

>> after the code below is executed.

>>

>> Louis Kessler

>> Winnipeg, Manitoba, Canada

>>

>>

>>

>> "Sergey Tkachenko" <[email protected]> wrote in message

>> news:[email protected]...

>>> RichView does not support overwrite mode directly.

>>> But one solution is possible - selecting a next character after

>>> caret on key pressing. The code is below.

>>>

>>> var IgnoreNextChar: Boolean = False;

>>>

>>> procedure TForm1.RichViewEdit1KeyDown(Sender: TObject; var Key:

>>>   Word; Shift: TShiftState);

>>> begin

>>>   IgnoreNextChar := RichViewEdit1.SelectionExists;

>>> end;

>>>

>>> procedure TForm1.RichViewEdit1KeyPress(Sender: TObject; var Key:

>>> Char); var rve: TCustomRichViewEdit;

>>>     ItemNo, Offs: Integer;

>>> begin

>>>   if IgnoreNextChar then begin

>>>     IgnoreNextChar := False;

>>>     exit;

>>>   end;

>>>   IgnoreNextChar := False;

>>>   if not ((Key=#9) or (Key>=' ')) then

>>>     exit;

>>>   rve := RichViewEdit1.TopLevelEditor;

>>>   if rve.SelectionExists then

>>>     exit;

>>>   ItemNo := rve.CurItemNo;

>>>   Offs  := rve.OffsetInCurItem;

>>>   if (Offs>=rve.GetOffsAfterItem(ItemNo)) then begin

>>>     if (ItemNo+1<rve.ItemCount) and

>>>        not rve.IsFromNewLine(ItemNo+1) then begin

>>>       inc(ItemNo);

>>>       Offs := rve.GetOffsBeforeItem(ItemNo);

>>>       end

>>>     else

>>>       exit;

>>>   end;

>>>   rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs+1);

>>>   rve.Invalidate;

>>> end;





Powered by ABC Amber Outlook Express Converter