sAlphaImageList.Count D2010

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33198
    schwa226
    Participant

    Hi,

    I just switched to Delphi 2010 and still Aplhaskin v6.44.

    Now I have trouble with this function:

    CODE
            for i := 0 to sAlphaImageList.Count – 1 do
            begin
              SizeOfIcon := sAlphaImageList.Items.ImgData.Size;
            end;

    With D2010 it fails.
    sAlphaImageList.Count is 20.
    But sAlphaImageList.Items.Count = 0???

    I remember that this was working with D2009. Is there a way to fix this?

    thx!

    EDIT:
    I found out if I add one Icon manually the sAlphaImageList.Items.Count will have the value 1.
    When I add Icons in this way: sAlphaImageList.AddIcon(TempIcon);
    the sAlphaImageList.Items.Count will not increase.

    Also I tried the Eval Latest Beta version from 30.12.2009. Same problem.

    #41471
    schwa226
    Participant

    Ok, it looks like no bug to Delphi 2010, 2009…

    If you use AddIcon the Icon will be added, but no item will be added.
    If manually add icon also a item will be added.

    dirty workaround:

    CODE
      Function AddTIcon(var ImageList : TsAlphaImageList; const Icon : TIcon): Integer;
      var
        TempStream : TMemoryStream;
        NewItem : TsImgListItem;
      begin
        TempStream := TMemoryStream.Create;
        Result := -1;
        try
          Icon.SaveToStream(TempStream);
          NewItem := TsImgListItem.Create(ImageList.Items);
          NewItem.ImgData.SetSize(TempStream.Size);
          CopyMemory(NewItem.ImgData.Memory,TempStream.Memory,TempStream.Size);
          Result := ImageList.AddIcon(Icon);
        finally
          TempStream.Free;
        end;
      end;

    #41513
    Support
    Keymaster

    Hello
    Try to add “sAlphaImageList1.AcBeginUpdate” before adding icons and “sAlphaImageList.AcEndUpdate(True)” after adding.
    Items must be added automatically.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.