Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Compiler Error
Fri, Mar 27 2020 6:40 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

I have the following code that worked in EWB2:

unit TestClass;

interface

type
 TTestClass = class

 private

  FMaterialList: array of string;

public
  property  MaterialListCount: Integer read GetMaterialListCount write SetMaterialListCount;
end;

var

implementation

function TTestClass.GetMaterialListCount: Integer;
begin
  Result := Length(FMaterialList);
end;

procedure TTestClass.SetMaterialListCount(Value: Integer);
begin
  SetLength(FMaterialList,Value);
end;

end.


In EWB3 it throws and error saying:

[Error] TestClass.wbs (13,46): Expected a reference to a Integer class member declaration compatible with the MaterialListCount property

It refers to this line:

  property  MaterialListCount: Integer read GetMaterialListCount write SetMaterialListCount;
Chris Holland
[Team Elevate]
Fri, Mar 27 2020 10:46 AMPermanent Link

Matthew Jones

Chris Holland wrote:

> I have the following code that worked in EWB2:
> ..
> In EWB3 it throws and error saying:
>
> [Error] TestClass.wbs (13,46): Expected a reference to a Integer class member declaration compatible with the MaterialListCount property
>
> It refers to this line:
>
>    property  MaterialListCount: Integer read GetMaterialListCount write SetMaterialListCount;
> Chris Holland
> [Team Elevate]

I that code is as-is, then the definitions of the functions should be in the class definition too. EWB2 was wrong to accept it.
Fri, Mar 27 2020 2:05 PMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi Matthew,

They were in there but they were in the wrong place. Thanks for pointing me in the right direction, all working now.

Chris Holland

"Matthew Jones" wrote:

Chris Holland wrote:

> I have the following code that worked in EWB2:
> ..
> In EWB3 it throws and error saying:
>
> [Error] TestClass.wbs (13,46): Expected a reference to a Integer class member declaration compatible with the MaterialListCount property
>
> It refers to this line:
>
>    property  MaterialListCount: Integer read GetMaterialListCount write SetMaterialListCount;
> Chris Holland
> [Team Elevate]

I that code is as-is, then the definitions of the functions should be in the class definition too. EWB2 was wrong to accept it.
Chris Holland
[Team Elevate]
Image