Page 1 of 1

Selecti the Inserted Item

Posted: Thu Oct 20, 2005 2:38 pm
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;

Posted: Fri Oct 21, 2005 5:03 pm
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;

Posted: Fri Oct 21, 2005 5:15 pm
by frank van den bergh
Thanks Sergey,
That works!