比如
TUIMsg = record
     nCurRow       : integer;      
     nCurCol       : integer;
     sInfo     : String;        //other infomation
   end;
TUIMsgPointer = ^TUIMsg;TRichEdit2 = class(TRichEdit)
private
   // Msg:LongInt;{ Private declarations }
    FnMaxRow:Integer;
    procedure SetnMaxRow(const Value: Integer);
protected{ Protected declarations }
public
    UIMsgPointer:TUIMsgPointer;{ other fields and methods}
public
    constructor Create(AOwner: TComponent); override;
    procedure wndproc(var message:Tmessage);override;
    property nMaxRow:Integer  read FnMaxRow write SetnMaxRow;
{ Public declarations }published{ Published declarations }
end;procedure Register;implementationprocedure Register; begin 
RegisterComponents('Temp', [TRichEdit2]);
end;....(略)constructor TRichEdit2.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  //UIMsgPointer := TUIMsgPointer.Create(Self);
  UIMsgPointer.nCurRow:=-1;
  UIMsgPointer.nCurCol:=-1;
  UIMsgPointer.sInfo:='';
end;....(略)因为该控件重载了procedure wndproc(var message:Tmessage);override;
而期间可能会对UIMsgPointer.nCurRow等进行操作。所以想知道他们应该在
什么地方被初始化好。如果照上面的代码,编译不会有问题,但是
当添加好后,
如果新建一个form,把TrichEdit2控件拖一个实例到form上会立刻报异常
不清楚why。
希望ggjjddmm们指点下。OS=2k Server+D7