Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/RTTI    [ Add a report in this area ]  
Report #:  105814   Status: Open
[x64] IsStoredProp function in the System.TypInfo unit does not support indexed properties when compiling to 64-bit
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Sergey Mogilnikov
Report Type:  Basic functionality failure Date Reported:  5/23/2012 1:07:15 AM
Severity:    Serious / Highly visible problem Last Updated: 5/24/2012 12:15:00 AM
Platform:    All versions Internal Tracking #:   28459
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 1
Description
[x64]
The IsStoredProp function in the System.TypInfo unit does not support indexed properties when compiling to 64-bit.

The IsStoredProp function works as expected when compiling to 32-bit
Steps to Reproduce:
See the attached example.
-----------------
unit Unit2;
interface
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    function GetMyProperty(const Index: Integer): Boolean;
    function IsMyPropertyStored(const Index: Integer): Boolean;
    procedure SetMyProperty(const Index: Integer; const Value: Boolean);
  published
    property MyProperty1: Boolean index 0 read GetMyProperty write SetMyProperty stored IsMyPropertyStored;
    property MyProperty2: Boolean index 1 read GetMyProperty write SetMyProperty stored IsMyPropertyStored;
    property MyProperty3: Boolean index 2 read GetMyProperty write SetMyProperty stored IsMyPropertyStored;
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

uses
  System.TypInfo;

{ TForm2 }
procedure TForm2.Button1Click(Sender: TObject);
begin
  if IsStoredProp(Self, 'MyProperty1') then // Must return true, see IsMyPropertyStored method for implementation details
    ShowMessage('Ok!')
  else
    ShowMessage('Failed!');
end;

function TForm2.GetMyProperty(const Index: Integer): Boolean;
begin
  Result := True;
end;

function TForm2.IsMyPropertyStored(const Index: Integer): Boolean;
begin
  Result := Index = 0; // only first property should be stored
end;

procedure TForm2.SetMyProperty(const Index: Integer; const Value: Boolean);
begin
  // do nothing
end;

end.
-----------------
Workarounds
None
Attachment
105814.zip
Comments

Tomohiro Takahashi at 5/24/2012 1:39:04 AM -
This report was opened with valid Internal Tracking Number.
Thanks.

Server Response from: ETNACODE01