TsAlphaImageList Clear/Delete doesnt work for me

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #52682
    BionicWave
    Participant

      It works for me if i do the following:

      a) Delete all indexes and items:

      Code:
      imgLst.Clear;
      imgLst.Items.Clear;

      😎 Add the amount of items i want to be in the list with a dummy-picture:

      Code:
      for i:=0 to sl.count-1 do
      begin
      with TsImgListItem(imgLstBlocks.Items.Add) do
      begin
      ImageFormat := ifPNG;
      PixelFormat := pf32bit;
      ImgData.LoadFromFile(dummy);
      end;
      end;

      c) Delete all indexes and items again:

      Code:
      imgLst.Clear;
      imgLst.Items.Clear;

      d) Now i can load my images into the list and everything works as expected.

      I found something funny.

      1) Drop a imagelist onto your form.

      2) Load some icons in designtime to the list, say 5.

      3) Try to delete and load more then 5 icons at runtime, lets say 10.

      4) The last step wont work. But you can see that at least 5 icons were loaded, the last 5 icons

      you tried loading are missing.

      That lead to the steps a) to c) i mentioned above.

      #52692
      Support
      Keymaster

        Hello!

        Standard “Clear” procedure don't work completely for some reasons, try this construction, please:

        Code:
        sAlphaImageList1.AcBeginUpdate;
        sAlphaImageList1.Items.Clear;
        sAlphaImageList1.Clear;
        sAlphaImageList1.AcEndUpdate;
      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.