3 <title>KOL Help: TObj object (main frame)
</title>
7 <body bgcolor=
"#FFFFEF" text=
"#000000" link=
"#008080" vlink=
"#008000" alink=
"#808000">
8 <p><font face=
"Courier" color=
"#800080"><b>TObj( unit
<a href=kol_pas.htm
>KOL.pas
</a> )
9 <font face=
"Wingdings">ï
</font> <a href=_tobj.htm
>_TObj
</a>
12 TObj = object(
<a href=_tobj.htm
target=
"_top">_TObj
</a> )
14 Prototype for all objects of KOL. All its methods are important to
15 implement objects in a manner similar to Delphi TObject class.
16 <h3 align=
"center"><font color=
"#FF8080">TObj properties
</font></h3>
17 <a name=
"refcount"></a>
19 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>RefCount
</b></font>:
<b>Integer
</b>;
</font>
20 <font face=
"Webdings" size=
7>Ñ</font>
25 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Tag
</b></font>:
<b>DWORD
</b>;
</font>
29 <h4 align=
"center"><font color=
"black">Properties, inherited from
<a href=
"_tobj.htm" target=
"_top">_TObj
</a></font></h4>
30 <h3 align=
"center"><font color=
"#FF8080">TObj methods
</font></h3>
31 <a name=
"destroy"></a>
33 <font face=
"Courier" color=
"#800080"><b>destructor
</b> <font color=
"#808000"><b>Destroy
</b></font>;
<b>virtual
</b>;
</font>
34 <font face=
"Webdings" size=
7>N</font>
36 Disposes memory, allocated to an object. Does not release huge strings,
37 dynamic arrays and so on. Such memory should be freeing in overriden
42 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Final
</b></font>;
</font>
43 <font face=
"Webdings" size=
7>N</font>
45 Is called in destructor to perform
<a href=#ondestroy
target=
"main">OnDestroy
</a> event call and to
46 released objects, added to
<a href=#fautofree
target=
"main">fAutoFree
</a> list.
50 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Free
</b></font>;
</font>
52 Before calling destructor of object, checks if passed pointer is not
53 nil - similar what is done in VCL for TObject. It is ALWAYS recommended
54 to use Free instead of
<a href=#destroy
target=
"main">Destroy
</a> - see also comments to
<a href=#refinc
target=
"main">RefInc
</a>,
<a href=#refdec
target=
"main">RefDec
</a>.
56 <a name=
"instancesize"></a>
58 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>InstanceSize
</b></font>:
<b>Integer
</b>;
</font>
60 Returns a size of object instance.
64 <font face=
"Courier" color=
"#800080"><b>constructor
</b> <font color=
"#808000"><b>Create
</b></font>;
</font>
66 Constructor. Do not call it. Instead, use New
<objectname
> function
67 call for certain object, e.g.,
<a href=kol_pas.htm#newlabel
target=
"_top">NewLabel
</a>( AParent, 'caption' );
69 <a name=
"ancestorofobject"></a>
71 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>AncestorOfObject
</b></font>( Obj:
<b>Pointer
</b> ):
<b>Boolean
</b>;
</font>
73 Is intended to replace 'is' operator, which is not applicable to objects.
75 <a name=
"vmtaddr"></a>
77 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>VmtAddr
</b></font>:
<b>Pointer
</b>;
</font>
79 Returns addres of virtual methods table of object.
83 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>RefInc
</b></font>;
</font>
89 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>RefDec
</b></font>;
</font>
91 Decrements reference count. If it is becoming
<0, and
<a href=#free
target=
"main">Free
</a>
92 method was already called, object is (self-) destroyed. Otherwise,
93 <a href=#free
target=
"main">Free
</a> method does not destroy object, but only sets flag
94 "<a href=#free
target=
"main">Free
</a> was called
".
96 Use RefInc..RefDec to provide a block of code, where
97 object can not be destroyed by call of
<a href=#free
target=
"main">Free
</a> method.
98 This makes code more safe from intersecting flows of processing,
99 where some code want to destroy object, but others suppose that it
102 If You want to release object at the end of block RefInc..RefDec,
103 do it immediately BEFORE call of last RefDec (to avoid situation,
104 when object is released in result of RefDec, and attempt to
105 destroy it follow leads to AV exception).
107 <a name=
"add2autofree"></a>
109 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Add2AutoFree
</b></font>( Obj:
<a href=kol_pas.htm#pobj
target=
"_top">PObj
</a> );
</font>
111 Adds an object to the list of objects, destroyed automatically
112 when the object is destroyed. Do not add here child controls of
113 the TControl (these are destroyed by another way). Only non-control
114 objects, which are not destroyed automatically, should be added here.
116 <a name=
"add2autofreeex"></a>
118 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Add2AutoFreeEx
</b></font>( Proc:
<a href=kol_pas.htm#tobjectmethod
target=
"_top">TObjectMethod
</a> );
</font>
120 Adds an event handler to the list of events, called in destructor.
121 This method is mainly for internal use, and allows to auto-destroy
122 VCL components, located on KOL form at design time (in MCK project).
124 <h4 align=
"center"><font color=
"black">Methods, inherited from
<a href=
"_tobj.htm" target=
"_top">_TObj
</a></font></h4>
125 <h3 align=
"center"><font color=
"#FF8080">TObj events
</font></h3>
126 <a name=
"ondestroy"></a>
128 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>OnDestroy
</b></font>:
<a href=kol_pas.htm#tonevent
target=
"_top">TOnEvent
</a>;
</font>
130 This event is provided for any KOL object, so You can provide your own
131 OnDestroy event for it.
133 <h4 align=
"center"><font color=
"black">Events, inherited from
<a href=
"_tobj.htm" target=
"_top">_TObj
</a></font></h4>
134 <h3 align=
"center"><font color=
"#FF8080">TObj fields
</font></h3>
135 <a name=
"fautofree"></a>
137 <font face=
"Courier" color=
"#800080"><font color=
"#808000"><b>fAutoFree
</b></font>:
<a href=kol_pas.htm#plist
target=
"_top">PList
</a>;
</font>
138 <font face=
"Webdings" size=
7>N</font>
140 Is called from a constructor to initialize created object instance
141 filling its fields with
0. Can be overriden in descendant objects
142 to add another initialization code there. (Main reason of intending
143 is what constructors can not be virtual in poor objects).
147 <font face=
"Courier" color=
"#800080"><font color=
"#808000"><b>fTag
</b></font>:
<b>DWORD
</b>;
</font>
148 <font face=
"Webdings" size=
7>N</font>
152 <h4 align=
"center"><font color=
"black">Fields, inherited from
<a href=
"_tobj.htm" target=
"_top">_TObj
</a></font></h4>
154 <p align=
"center">[
<a href=index.htm
>Index
</a> ]
</p>
155 <p align=
"center"><font face=
"Comic Sans MS"><small>This help is generated
22-Sep-
2005 by KOL Help generator, (C)
2000-
2001 by Vladimir Kladov
<br>Modified (C)
2003 by Alexander Bartov
</small></font></p>