TObj = object( _TObj )
Prototype for all objects of KOL. All its methods are important to implement objects in a manner similar to Delphi TObject class.
property RefCount: Integer;
Ñ
property Free: Integer;
Ñ
Before calling destructor of object, checks if passed pointer is not
nil - similar what is done in VCL for TObject. It is ALWAYS recommended
to use Free instead of Destroy - see also comments to RefInc, RefDec.
property Tag: DWORD;
Custom data field.
destructor Destroy; virtual;
Disposes memory, allocated to an object. Does not release huge strings,
dynamic arrays and so on. Such memory should be freeing in overriden
destructor.
procedure Final;
It is called in destructor to perform OnDestroy event call and to
released objects, added to fAutoFree list.
procedure RefInc;
See comments below.
function RefDec: Integer;
Decrements reference count. If it is becoming <0, and Free
method was already called, object is (self-) destroyed. Otherwise,
Free method does not destroy object, but only sets flag
"Free was called".
Use RefInc..RefDec to provide a block of code, where
object can not be destroyed by call of Free method.
This makes code more safe from intersecting flows of processing,
where some code want to destroy object, but others suppose that it
is yet existing.
If You want to release object at the end of block RefInc..RefDec,
do it immediately BEFORE call of last RefDec (to avoid situation,
when object is released in result of RefDec, and attempt to
destroy it follow leads to AV exception).
Actually, this "function" is a procedure and does not return
any sensible value. It is declared as a function for internal
needs (to avoid creating separate code for Free method)
function InstanceSize: Integer;
Returns a size of object instance.
constructor Create;
Constructor. Do not call it. Instead, use New<objectname> function
call for certain object, e.g., NewLabel( AParent, 'caption' );
function AncestorOfObject( Obj: Pointer ): Boolean;
Is intended to replace 'is' operator, which is not applicable to objects.
function VmtAddr: Pointer;
Returns addres of virtual methods table of object.
procedure Add2AutoFree( Obj: PObj );
Adds an object to the list of objects, destroyed automatically
when the object is destroyed. Do not add here child controls of
the TControl (these are destroyed by another way). Only non-control
objects, which are not destroyed automatically, should be added here.
procedure Add2AutoFreeEx( Proc: TObjectMethod );
Adds an event handler to the list of events, called in destructor.
This method is mainly for internal use, and allows to auto-destroy
VCL components, located on KOL form at design time (in MCK project).
procedure RemoveFromAutoFree( Obj: PObj );
Removes an object from auto-free list
procedure RemoveFromAutoFreeEx( Proc: TObjectMethod );
Removes a procedure from auto-free list
property OnDestroy: TOnEvent;
This event is provided for any KOL object, so You can provide your own
OnDestroy event for it.
fAutoFree: PList;
N
Is called from a constructor to initialize created object instance
filling its fields with 0. Can be overriden in descendant objects
to add another initialization code there. (Main reason of intending
is what constructors can not be virtual in poor objects).
fTag: DWORD;
N
Custom data.
[ Index ]
This help is generated 14-Jun-2010 by KOL Help generator, (C) 2000-2001 by Vladimir Kladov
Modified (C) 2003 by Alexander Bartov