Registriert seit: 27. Apr 2003
Ort: Bad Honnef
1.644 Beiträge
Delphi 2009 Professional
|
Re: objectreferenz austauschen ohne globale variablen!!!!
17. Nov 2005, 17:56
Hallo,
ungefähr so
Delphi-Quellcode:
Type
TMyForm = class(TForm)
private
FRefObject : TObject;
...
end;
procedure TMyForm.CreateRefObject;
begin
If Not Assinged(FRefObject) then
FRefObject:=TOBject.Create;
end;
procedure TMyForm.DoSomething(aRefObject : TObject);
begin
If Assinged(FRefObject) then
MachWas
end;
procedure TMyForm.XYZClick(Sender : TObject);
begin
CreateRefObject;
DoSomething(FRefObject );
end;
I come from outer space to save the human race
|