RV.clear / free

General TRichView support forum. Please post your questions here
Post Reply
skydiablo
Posts: 16
Joined: Wed Feb 14, 2007 1:31 pm

RV.clear / free

Post by skydiablo »

hi... (sorry for my bad english)

i have the same problem like this: http://www.trichview.com/forums/viewtopic.php?t=1037

if ein clear/free the RV, i get an error. i add some gifs, the source from the gifs are a TList -> TJvGIFImage. so i share same GIFs with the same index of the TList.

Code: Select all

//INSERT GIF
          GIF := SmilieManager.GetSmilie(ord(sl[i][1]));
          if not Gif.Empty then
          begin
            form1.RichView1.AddPictureEx('',GIF,-1,rvvaBaseline);
          end;

//GetSmilie
function TSmilieManager.GetSmilie(index : byte) : TjvGIFImage;
begin
  if (index < self.Count) AND (index > 0) then
  begin
    result := self[index];
  end
  else
    result := self[0]; //ERROR Picture !!!
end;
so i use the same source if the same GIF are used. but if i clear/free the RV, the TList items will be destroyed and ERROR! how can i fix it ?

greez & thx, sky...
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The same problem, the same solution :)

Code: Select all

          //INSERT GIF 
          GIF :=  TjvGIFImage.Create;
          GIF.Assign(SmilieManager.GetSmilie(ord(sl[i][1]))); 
          if not Gif.Empty then 
            form1.RichView1.AddPictureEx('',GIF,-1,rvvaBaseline)
          else
            GIF.Free;
skydiablo
Posts: 16
Joined: Wed Feb 14, 2007 1:31 pm

Post by skydiablo »

so i cant use one instanse for all smilies ? hmmm, i need more RAM :D

i create a chat-control and if i chat with this control 10 hours, it can be many smilies !

but, thx !!!!

sky...
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

After calling Graphic1.Assign(Graphic2), both Graphic1 and Graphic2 use the same graphic object, so usage of memory and GDI resources are not so extensive.
Post Reply