TsAlphaImageList Clear/Delete doesnt work for me

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36338
    BionicWave
    Participant

    I searched the forum for this topic and found some entries that go back till 2011.

    As the topics always end with “this is fixed”, i will ask it that way:

    What do i have to do, to clear a TsAlphaImageList from all of its contents?

    #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 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.