Is there an issue with doing a .Clear on a TRichViewEdit and then attempting to enter text into it? Perhaps I must always do a Format after doing a clear? I'm not quite sure what the problem is because in most instances it does seem to work to do a Clear and then be able to type into the TRV control.
When it does cause an error, the first character typed causes an exception in the code below because CaretOffs = -1.
procedure TRVEditRVData.InsertTextTyping(text: String; Key: Char);
var ditem: TRVDrawLineInfo;
item: TCustomRVItemInfo;
ItemNo, Offs, Len : Integer;
s: String;
Minus,SavedCaretOffs: Integer;
{.....................................................}
procedure DoInsert;
begin
if not TCustomRichViewEdit(RichView).BeforeChange(False) then
exit;
BeginUndoSequence(rvutInsert, True);
InsertString(Text,FCurTextStyleNo,True,False); { inserting character in new item }
Refresh;
Change;
end;
{.....................................................}
begin
if (GetRVStyle=nil) or (PartialSelectedItem<>nil) or not CanDelete then begin
Beep;
exit;
end;
Len := Length(text);
{$IFNDEF RVDONOTUSEUNICODE}
if GetRVStyle.TextStyles[GetActualCurStyleNo].Unicode then
Len := Length(text) div 2;
{$ENDIF}
CaretDrawItemNo := CharEnds.Items[CaretOffs].DrawItemNo;
CaretOffs Problem
-
- Posts: 148
- Joined: Wed Dec 07, 2005 2:02 pm
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: