Page 1 of 1

RV.clear / free

Posted: Thu Feb 15, 2007 3:47 pm
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...

Posted: Thu Feb 15, 2007 4:52 pm
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;

Posted: Thu Feb 15, 2007 9:56 pm
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...

Posted: Fri Feb 16, 2007 3:04 pm
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.