Delphi 2010 " is" statement behaves differently than Delphi 7's?!

Posted by Tom1952 on Stack Overflow See other posts from Stack Overflow or by Tom1952
Published on 2010-06-08T18:30:25Z Indexed on 2010/06/08 18:32 UTC
Read the original article Hit count: 266

Filed under:

Why does the code below return TRUE in Delphi 7 and FALSE in Delphi 2010? TBitBtn is a descendant of TButton.

    type
      TForm1 = class(TForm)
        Button1: TButton;
        BitBtn1: TBitBtn;
        procedure Button1Click(Sender: TObject);
      private
      public
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TestControl( aControl: TControl);
    begin
      if (aControl is TButton) then showmessage('TRUE') else showmessage('FALSE');
    end;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      TestControl(BitBtn1);
    end;

© Stack Overflow or respective owner

Related posts about delphi