Show: Object Pascal C++
Display Preferences

E2180 Dispid '%d' already used by '%s' (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

An attempt to use a dispid which is already assigned to another member of this class.


program Produce;

  type
    Base = class
      v : Integer;
      procedure setV(x : Integer);
      function getV : Integer;
    automated
      property Value : Integer read getV write setV dispid 151;
      property SecondValue : Integer read getV write setV dispid 151;
    end;

  procedure Base.setV(x : Integer);
  begin v := x;
  end;

  function Base.getV : Integer;
  begin getV := v;
  end;

begin
end.

Each automated property's dispid must be unique, thus SecondValue is in error.


program Solve;

  type
    Base = class
      v : Integer;
      procedure setV(x : Integer);
      function getV : Integer;
    automated
      property Value : Integer read getV write setV dispid 151;
      property SecondValue : Integer read getV write setV dispid 152;
    end;

  procedure Base.setV(x : Integer);
  begin v := x;
  end;

  function Base.getV : Integer;
  begin getV := v;
  end;

begin
end.

Giving a unique dispid to SecondValue will remove the error.

Personal tools
In other languages