Tabc = class(TCustomControl)
  private
    { Private declarations }
    ra:integer;
    procedure rb(value:integer);  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
    property testvalue:integer read ra write rb;   //这个语句怎么理解啊
    
    属性,读和写是怎么理解啊。属性编辑窗中先是....显示的是 谁的值  ?  end;procedure Register;implementation
procedure Tabc.rb(value:integer);
begin
   if ra<>value then
       begin
      showmessage('value'+inttostr(value));
      showmessage('testvalue'+inttostr(testvalue));
       ra:=value;
       showmessage('ra'+inttostr(ra));
       end;
end;

解决方案 »

  1.   

    定义property的read和write方法其实是用来界定外部访问该属性的手段。
    比如:
      var abc:Tabc;
      abc.testValue := 1; 这个时候是调用了write手段,也就是:abc.testValue := rb(1);
    而如:
      var i:Integer;
      i := abc.testValue; 这个时候是调用了read手段,也就是:i := ra;
      

  2.   

    楼上的,兄弟,是不不这样
    先是在属性编辑器中: testvalue、Read、Write初始化都为0,当输入值时,这时就 Read ra赋给 testvalue.
    这时再把testvalue值传给 rb的参数,就执行了 rb方法