trichview.support
Re: Overtype mode does not work |
Author |
Message |
Sergey Tkachenko |
Posted: 06/26/2002 17:25:38 Below is a copy of my old answer to the similar question: RV does not support overwrite mode directly. But one solution is possible - selecting the next character after caret on key pressing. The code is below. It looks like this code works on the latest version of RichView. But there were some changes in keyboard input since the last trial version. If this code will not work properly on your version, try to call rve.DeleteSelection at the end of RichViewEdit1KeyPress (instead of Invalidate). 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; while rve.InplaceEditor<>nil do rve := TCustomRichViewEdit(rve.InplaceEditor); 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; > Hi, > > Is it my mistake? > I can't overtype in TRichView, pressing 'insert' key does nothing. > Workaround? > > BTW excellent work with TRichView, it saved my deadline!! > > Frank > > |
Powered by ABC Amber Outlook Express Converter