I am using the RichViewEdit to list the record contents , which read from database. These records increase at any moment, so the RichViewEdit reads all new records from database per second and paints record contents.My code as follows:
Code: Select all
Type
TInfo = Record
title:string;
phone:string;
name:string;
content:string;
End;
function MakeTag(s: String): Integer;
begin
Result := Integer(StrNew(PChar(s)));
end;
//Add record into RichViewEdit
procedure ListRecord;
var
myInfo:TInfo;
RichVE:TRichViewEdit;
content_1,content_2:string;
begin
content_1:=myInfo.content; //РЕПўДЪИЭТ»
content_2:='name:='+ myInfo.name + ',' + myInfo.content; //РЕПўДЪИЭ¶ю
RichVE.AddNL(myInfo.title,0,2); //ФцјУ±кМв
RichVE.AddTab(0,-1);
RichVE.AddHotspotExTag('µз»°',1,1,ImageList,-1,MakeTag(myInfo.phone)); //ФЪ±кМвєуГжФцјУµз»°Нј±кі¬ј¶БґЅУЈ¬µг»чёГБґЅУ¶ЇМ¬ПФКѕµз»°єЕВл
RichVE.AddNlTag(content_1,2,0,MakeTag(content_2));//РЕПўДЪИЭµДі¬ј¶БґЅУ,ХэіЈПФКѕКЗ content_1µДДЪИЭ,µ±УГ»§µг»чК±,ПФКѕ content_2 µДДЪИЭ.
RichVE.AddBreakEx(0, rvbsLine, clRed); //»МхПЯ
RichVE.FormatTail;
end;
//RichVE onJump Event
procedure RichVEJump(Sender: TObject; id: Integer);
var
RVData: TCustomRVFormattedData;
ItemNo: Integer;
i:integer;
hideInfo:string;
begin
RichVE.GetJumpPointLocation(id,Rvdata,itemNo);
if RVData<>nil then begin
hideInfo := GetTagStr(RVData.GetItemTag(ItemNo));
RichVE.ReadOnly := false;
RichVE.SetItemTextEd(ItemNo,hideInfo);//¶ЇМ¬ЙиЦГПФКѕµДРЕПўОЄТюІШµДРЕПўДЪИЭ
RichVE.ReadOnly := true;
RichVE.Refresh;
end;
end;
as above code, it can append record into RichViewEdit ,list Hypertext contents,and can dynamic paints the contents when user clicked.
Now, I want to insert the ervery record into RichViewEdit at line 0,but not append the last line.
I have tested, used the "insert" method must be modify mode,but the Hypertext can not answer "onJump" events.
Q:
How can insert contents into RichViewEdit at line 0 and the hypertext can answer "onJump" events.
The cursor always at the last line or fist line,when insert record into RichViewEdit.
How can I locked a certain line,when insert record or append record,RichViewEdit not ScrollTo the last line .