trichview.support
Search, Replacing and SelectionBounds |
Author |
Message |
Marcos Lommez |
Posted: 02/23/2004 11:02:37 I wanna to replace some text to a emotion icon. In my case im using gifs. But is kind slow and an error is happening when deselecting the text. I receive a message error like this: EStringListError with message "List index out of bounds (-3)" Im unselecting the text in a wrong way? Is there another way to do it? thanks in advance! there is the code of what im doing procedure TFrmMensagem.SearchAndInsertIcon(var rv: TRichViewEdit; const Code: String; Icon: TBlobField); var Gif: TGifImage; MS: TMemoryStream; Img: TImage; ItemNo, Offs: Integer; begin try rv.SetSelectionBounds(0, rv.GetOffsBeforeItem(0), 0, rv.GetOffsBeforeItem(0)); while rv.SearchText(Code, [rvseoDown]) do begin Gif := TGIFImage.Create; MS := TMemoryStream.Create; Icon.SaveToStream(MS); MS.Position := 0; Gif.LoadFromStream(MS); Img := TImage.Create(nil); Img.Picture.Assign(Gif); Img.Height := Img.Picture.Height; Img.Width := Img.Picture.Width; rv.InsertControl('', Img, rvvaBaseline); end; ItemNo := rv.ItemCount-1; Offs := rv.GetOffsAfterItem(ItemNo); rv.SetSelectionBounds(-ItemNo,Offs,ItemNo,Offs); // - >>> here is where the error occurs except end; |
Powered by ABC Amber Outlook Express Converter