initial commit
[rofl0r-KOL.git] / main_tobj.htm
blobc8bbf25b91c2e9e1e31f332c62cf46f0544ca8b4
1 <html>
2 <head>
3 <title>KOL Help: TObj object (main frame)</title>
4 <base target="_top">
5 </head>
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>
10 </b></font></p>
11 <p><b>
12 TObj = object( <a href=_tobj.htm target="_top">_TObj</a> )
13 </b></p>
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>
18 <p>
19 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>RefCount</b></font>: <b>Integer</b>;</font>
20 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#209;</font>&nbsp;&nbsp;&nbsp;
21 <br>
22 </p>
23 <a name="tag"></a>
24 <p>
25 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Tag</b></font>: <b>DWORD</b>;</font>
26 <br>
27 Custom data field.
28 </p>
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>
32 <p>
33 <font face="Courier" color="#800080"><b>destructor</b> <font color="#808000"><b>Destroy</b></font>; <b>virtual</b>;</font>
34 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#78;</font>&nbsp;&nbsp;&nbsp;
35 <br>
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
38 destructor.
39 </p>
40 <a name="final"></a>
41 <p>
42 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Final</b></font>;</font>
43 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#78;</font>&nbsp;&nbsp;&nbsp;
44 <br>
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.
47 </p>
48 <a name="free"></a>
49 <p>
50 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Free</b></font>;</font>
51 <br>
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>.
55 </p>
56 <a name="instancesize"></a>
57 <p>
58 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>InstanceSize</b></font>: <b>Integer</b>;</font>
59 <br>
60 Returns a size of object instance.
61 </p>
62 <a name="create"></a>
63 <p>
64 <font face="Courier" color="#800080"><b>constructor</b> <font color="#808000"><b>Create</b></font>;</font>
65 <br>
66 Constructor. Do not call it. Instead, use New&lt;objectname&gt; function
67 call for certain object, e.g., <a href=kol_pas.htm#newlabel target="_top">NewLabel</a>( AParent, 'caption' );
68 </p>
69 <a name="ancestorofobject"></a>
70 <p>
71 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>AncestorOfObject</b></font>( Obj: <b>Pointer</b> ): <b>Boolean</b>;</font>
72 <br>
73 Is intended to replace 'is' operator, which is not applicable to objects.
74 </p>
75 <a name="vmtaddr"></a>
76 <p>
77 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>VmtAddr</b></font>: <b>Pointer</b>;</font>
78 <br>
79 Returns addres of virtual methods table of object.
80 </p>
81 <a name="refinc"></a>
82 <p>
83 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>RefInc</b></font>;</font>
84 <br>
85 See comments below.
86 </p>
87 <a name="refdec"></a>
88 <p>
89 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>RefDec</b></font>;</font>
90 <br>
91 Decrements reference count. If it is becoming &lt;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 &quot;<a href=#free target="main">Free</a> was called&quot;.
95 <br>
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
100 is yet existing.
101 <br>
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).
106 </p>
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>
110 <br>
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.
115 </p>
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>
119 <br>
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).
123 </p>
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>
129 <br>
130 This event is provided for any KOL object, so You can provide your own
131 OnDestroy event for it.
132 </p>
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 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#78;</font>&nbsp;&nbsp;&nbsp;
139 <br>
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).
144 </p>
145 <a name="ftag"></a>
147 <font face="Courier" color="#800080"><font color="#808000"><b>fTag</b></font>: <b>DWORD</b>;</font>
148 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#78;</font>&nbsp;&nbsp;&nbsp;
149 <br>
150 Custom data.
151 </p>
152 <h4 align="center"><font color="black">Fields, inherited from <a href="_tobj.htm" target="_top">_TObj</a></font></h4>
153 <hr>
154 <p align="center">[&nbsp;<a href=index.htm>Index</a>&nbsp;]</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>
156 </body>
157 </html>