<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css">
<title>
Gambas Documentation - Object.Attach
 (gb)</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../../../help+en"><img class="flag" alt="Home" border="0" src="../../../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../object+en">Up</a>&nbsp;
<a href="../object+en">Previous</a>&nbsp;
<a href="call+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Object.Attach
 (gb)</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><font color="blue">STATIC</font> <font color="blue">SUB</font> <b>Attach</b> <font color="blue">(</font> <u>Object</u> <font color="blue">AS</font> <font color="#0080FF">Object</font><font color="blue">,</font> <u>Parent</u> <font color="blue">AS</font> <font color="#0080FF">Object</font><font color="blue">,</font> <u>Name</u> <font color="blue">AS</font> <font color="#0080FF">String</font> <font color="blue">)</font></pre>
Attach an object to its parent.
<p>
<u>Name</u> is the name used for searching event handlers in the <u>Parent</u> object.
<p>
Every event raised by the object will be managed by an event-handler
located in its parent.
<p>
If the parent is a class, then the the event-handlers will be static
methods of the class.
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">PUBLIC Process1 AS Process
...
Process1 = SHELL &quot;find /&quot; FOR READ
Object.Attach(Process1, ME, &quot;Process1&quot;)
...

PUBLIC SUB Process1_Read()

   Message.Info(&quot;Got output from Process1!&quot;)
   ' and then read and do something with the output...

END</pre>

</div>
</body>
</html>

