TBX icon indicating copy to clipboard operation
TBX copied to clipboard

Delphi 11.0 support

Open zedxxx opened this issue 2 years ago • 2 comments

zedxxx avatar Mar 08 '22 15:03 zedxxx

Hi! Thank you for the pull request.

I do not completely understand though why we have to change {$IF CompilerVersion > 33} to {$IF CompilerVersion > 35} in order to support Delphi 11.

Isn't the {$IF CompilerVersion > 33} condition also valid for Delphi 11?

I.e. {$IF CompilerVersion > 33} already provides support for Delphi 11, and changing it to {$IF CompilerVersion > 35} drops support for previous Delphi versions.

Or maybe I do not understand something?

plashenkov avatar Apr 08 '22 02:04 plashenkov

The condition is only used to show the user a warning if he uses an unknown compiler:

  {$IF CompilerVersion > 35}
    {$MESSAGE WARN 'Check if System.ImageList.TBaseImageList is still the same and adjust the IFDEF'}
  {$IFEND}

In Delphi 11.1 TBaseImageList class declaration do not changed, so we hide this warning and can safely use our TCustomImageListCrack (we need it to access to the private fields FUpdateCount and FChanged).

In the future, when Delphi 12 will be released, user will see the warning again and he must check declaration of TBaseImageList and fix TCustomImageListCrack if needed.

{ we need access to some private fields in TCustomImageList }
type
{$HINTS OFF}

  {$IF CompilerVersion > 35}
    {$MESSAGE WARN 'Check if System.ImageList.TBaseImageList is still the same and adjust the IFDEF'}
  {$IFEND}

  {$IF CompilerVersion >= 29}
  TCustomImageListCrack = class(TComponent)
  private
    FUpdateCount: Integer;
    FLinks: Pointer;
    FChanged: Boolean;
  end;
  {$ELSE}
  TCustomImageListCrack = class(TComponent)
  private
    FHeight: Integer;
    FWidth: Integer;
    FAllocBy: Integer;
    FHandle: HImageList;
    FDrawingStyle: TDrawingStyle;
    FMasked: Boolean;
    FShareImages: Boolean;
    FImageType: TImageType;
    FBkColor: TColor;
    FBlendColor: TColor;
    FClients: TList;
    FBitmap: TBitmap;
    FMonoBitmap: TBitmap;
    FChanged: Boolean;
    FUpdateCount: Integer;
    FOnChange: TNotifyEvent;
  end;
  {$IFEND}
{$HINTS ON}

zedxxx avatar Apr 08 '22 06:04 zedxxx