1scopedobject − Create and manipulate a scoped class object.
3Name: enterscopecommand:
4Command‐Line Switch: ‐enterscopecommand
5Specifies a Tcl command to invoke when an object enters scope
6(i.e. when it is created..). The default is {}.
7Name: enterscopecommand:
8Command‐Line Switch: ‐enterscopecommand
9Specifies a Tcl command to invoke when an object exits scope
10(i.e. when it is deleted..). The default is {}.
11
12The scopedobject command creates a base class for defining Itcl
13classes which posses scoped behavior like Tcl variables. The ob‐
14jects are only accessible within the procedure in which they are
15instantiated and are deleted when the procedure returns. This
16class was designed to be a general purpose base class for sup‐
17porting scoped incr Tcl classes. The options include the execute
18a Tcl script command when an object enters and exits its scope.
19The scopedobject command creates a new Tcl command whose name is
21on the object. It has the following general form: pathName op‐
23havior of the command. The following commands are possible for
24scopedobject objects: pathName cget option Returns the current
25value of the configuration option given by option. Option may
26have any of the values accepted by the scopedobject command.
28modify the configuration options of the object. If no option is
29specified, returns a list describing all of the available options
30for pathName. If option is specified with no value, then the
31command returns a list describing the one named option (this list
32will be identical to the corresponding sublist of the value re‐
33turned if no option is specified). If one or more option−value
34pairs are specified, then the command modifies the given objects
35option(s) to have the given value(s); in this case the command
36returns an empty string. Option may have any of the values ac‐
37cepted by the scopedobject command.
38
39The scopedobject was primarily meant to be a base class. The
40following is an example of usage without inheritance:
41 proc scopedobject_demo {} {
42 iwidgets::scopedobject #auto ‐exitscopecommand {puts
43"enter scopedobject_demo"} ‐exitscopecommand {puts "exit
44scopedobject_demo"}
45 }
46
47 scopedobject_demo
48
49John A. Tucker scopedobject, object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66