Another example for clearifying my problem :

var CallNo : Integer;

Type TMyGraphic = class(TGraphic)
public
    constructor Create;  override;
    procedure Assign(Source: TPersistent); override;
end;

procedure TMyGraphic.Assign(Source: TPersistent);
begin
 //
end;

constructor TMyGraphic.Create;
begin
  inherited;
  CallNo := CallNo + 1;
end;


//------------------------------------------------------------------------
procedure TryIt;
var gCls : TGraphicClass;
    nGra : TGraphic;
    myPic : TPicture;
begin
    CallNo := 0;
    gCls := TGraphicClass(TMyGraphic);
    nGra := gCls.Create;
    ShowMessage(IntToStr(CallNo));   // 0          It Should be 1, but not,
Why ??????????

    myPic := TPicture.Create;
    myPic.Graphic := nGra;
    ShowMessage(IntToStr(CallNo));   // 1
end;

#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
For more information please visit www.marshalsoftware.com
#####################################################################################
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to