Recent

Author Topic: [Solved ] Timagelist.Onchage does not trigger when adding images?  (Read 1981 times)

jamie

  • Hero Member
  • *****
  • Posts: 6091
Isn't this event suppose to trigger when adding, deleting images ?
Does not seem to do anything here.

laz 1.8.0 Windows.
« Last Edit: January 26, 2018, 10:56:38 pm by jamie »
The only true wisdom is knowing you know nothing

balazsszekely

  • Guest
Re: Timagelist.Onchage does not trigger when adding images?
« Reply #1 on: January 26, 2018, 05:33:54 am »
The following code works fine with Lazarus Trunk/FPC 3.0.4:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   Bmp: TBitmap;
  4. begin
  5.   Bmp := TBitmap.Create;
  6.   try
  7.     Bmp.Width := 16;
  8.     Bmp.Height := 16;
  9.     Bmp.Canvas.Brush.Color := clRed;
  10.     Bmp.Canvas.FillRect(0, 0, 16, 16);
  11.     ImageList1.Insert(0, Bmp, Bmp);
  12.   finally
  13.     Bmp.Free;
  14.   end;
  15. end;
  16.  
  17. procedure TForm1.Button2Click(Sender: TObject);
  18. begin
  19.   ImageList1.Delete(0);
  20. end;
  21.  
  22. procedure TForm1.ImageList1Change(Sender: TObject);
  23. begin
  24.   ShowMessage('changing');
  25. end;  

OnChange is triggered both on Button1 and Button2 click.

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Timagelist.Onchage does not trigger when adding images?
« Reply #2 on: January 26, 2018, 10:56:11 pm »
I must apologize, it seems I set the OnChange event to the wrong TimageList, not the one I was actually
working with..

 Sorry about that, disaster is averted !
The only true wisdom is knowing you know nothing

balazsszekely

  • Guest
Re: [Solved ] Timagelist.Onchage does not trigger when adding images?
« Reply #3 on: January 26, 2018, 11:03:29 pm »
No problem @jamie. I'm glad it's working.  :)

 

TinyPortal © 2005-2018