type
  TWgComponent = class(TCustomControl)
  private
    FArrProp:array of string;  protected
    procedure SetArrProp(aStr:string);
    function GetArrProp(aIndex:integer):string;
  public  published
    property ArrProp:string read GetArrProp write SetArrProp;
  end;
我自己定义的一个控件(作来玩的),但在编译时,属性定义那一行总是
错误:Incompatible types
读写方法我都实现了。
请问,到底是哪儿有问题.

解决方案 »

  1.   

    查了一下帮助:
    Property accessIn a read specifier, if fieldOrMethod is a method, it must be a parameterless function whose result type is the same as the property's type.In a write specifier, if fieldOrMethod is a method, it must be a procedure that takes a single value or const parameter of the same type as the property.For example, given the declarationproperty Color: TColor read GetColor write SetColor;the GetColor method must be declared asfunction GetColor: TColor;and the SetColor method must be declared as one of these:procedure SetColor(Value: TColor);procedure SetColor(const Value: TColor);(The name of SetColor's parameter, of course, doesn抰 have to be Value.)所以你改为:
    function GetArrProp:string;
    就可以了!