Selecti the Inserted Item

General TRichView support forum. Please post your questions here
Post Reply
frank van den bergh
Posts: 6
Joined: Thu Oct 20, 2005 2:29 pm
Location: The Netherlands

Selecti the Inserted Item

Post by frank van den bergh »

After I insert a label item I want this label item to be the one and only selected item (and highlighted).

Unfortunately no luck.

Any suggestions?
Thanks for your help,
Frank.

This is a part of the source:

li := TRVLabelItemInfo.CreateEx(RichViewEdit1.RVData, TEXTSTYLE_VARIABLE, '['+Variable.Description+']');
If RichViewEdit1.InsertItem('', li)
then begin
ItemNo := RichViewEdit1.CurItemNo;
RichViewEdit1.ReFormat;
RichViewEdit1.SetSelectionBounds(ItemNo, RichViewEdit1.GetOffsAfterItem(ItemNo),
ItemNo, RichViewEdit1.GetOffsAfterItem(ItemNo)+1)
end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

var rve: TCustomRichViewEdit;

li := TRVLabelItemInfo.CreateEx(RichViewEdit1.RVData, TEXTSTYLE_VARIABLE, '['+Variable.Description+']'); 
If RichViewEdit1.InsertItem('', li)  then begin 
  rve := RichViewEdit1.TopLevelEditor;
  ItemNo := rve.CurItemNo; 
  rve.SetSelectionBounds(ItemNo, rve.GetOffsBeforeItem(ItemNo), ItemNo, rve.GetOffsAfterItem(ItemNo));
  rve.Invalidate;
end;
frank van den bergh
Posts: 6
Joined: Thu Oct 20, 2005 2:29 pm
Location: The Netherlands

Post by frank van den bergh »

Thanks Sergey,
That works!
Post Reply