1<TITLE>scopedobject - Create and manipulate a scoped \[incr Tcl\] class object.</TITLE> 2<H1>scopedobject - Create and manipulate a scoped \[incr Tcl\] class object.</H1> 3 4</pre><H2>SYNOPSIS</H2> 5<B>scopedobject<I> <I>objName </I>?<I>options</I>? 6</pre><H2>INHERITANCE</H2> 7None 8</pre><H2>STANDARD OPTIONS</H2> 9<P> 10<pre> 11Name: <B>enterscopecommand:</B> 12Command-Line Switch: <B>-enterscopecommand</B> 13</pre> 14<UL> 15Specifies a Tcl command to invoke when an object enters scope 16(i.e. when it is created..). The default is {}. 17</UL> 18<P> 19<pre> 20Name: <B>enterscopecommand:</B> 21Command-Line Switch: <B>-enterscopecommand</B> 22</pre> 23<UL> 24Specifies a Tcl command to invoke when an object exits scope 25(i.e. when it is deleted..). The default is {}. 26</UL> 27<P> 28</pre><HR> 29 30</pre><H2>DESCRIPTION</H2> 31<P> 32The <B>scopedobject</B> command creates a base class for defining 33Itcl classes which posses scoped behavior like Tcl variables. 34The objects are only accessible within the procedure in which 35they are instantiated and are deleted when the procedure returns. 36This class was designed to be a general purpose base class for 37supporting scoped incr Tcl classes. The options include the 38execute a Tcl script command when an object enters and exits its 39scope. 40</pre><H2>METHODS</H2> 41<P> 42The <B>scopedobject</B> command creates a new Tcl command whose 43name is <I>pathName</I>. This 44command may be used to invoke various operations on the object. 45It has the following general form: 46<pre> 47<I>pathName option </I>?<I>arg arg ...</I>? 48</pre> 49<I>Option</I> and the <I>arg</I>s 50determine the exact behavior of the command. The following 51commands are possible for scopedobject objects: 52</pre><H2>OBJECT-SPECIFIC METHODS</H2> 53<DL> 54<DT> <I>pathName <B>cget</B> <I>option</I> 55</I></B> 56<DD> Returns the current value of the configuration option given 57by <I>option</I>. 58<I>Option</I> may have any of the values accepted by the <B>scopedobject</B> 59command. 60</DL> 61<DL> 62<DT> <I>pathName</I> <B>configure</B> ?<I>option</I>? ?<I>value option value ...</I>? 63</I></B> 64<DD> Query or modify the configuration options of the object. 65If no <I>option</I> is specified, returns a list describing all of 66the available options for <I>pathName</I>. If <I>option</I> is specified 67with no <I>value</I>, then the command returns a list describing the 68one named option (this list will be identical to the corresponding 69sublist of the value returned if no <I>option</I> is specified). If 70one or more <I>option-value</I> pairs are specified, then the command 71modifies the given objects option(s) to have the given value(s); in 72this case the command returns an empty string. 73<I>Option</I> may have any of the values accepted by the <B>scopedobject</B> 74command. 75 76</DL> 77</pre><H2>EXAMPLE</H2> 78<UL> 79The scopedobject was primarily meant to be a base class. The 80following is an example of usage without inheritance: 81</UL> 82<P> 83<pre> 84 proc scopedobject_demo {} { 85 scopedobject #auto \ 86 -exitscopecommand {puts "enter scopedobject_demo"} \ 87 -exitscopecommand {puts "exit scopedobject_demo"} 88 } 89 90 scopedobject_demo 91 92</pre> 93</pre><H2>AUTHOR</H2> 94John A. Tucker 95</pre><H2>KEYWORDS</H2> 96scopedobject, object 97