1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1997 DSC Technologies Corporation
|
3 |
|
|
'\"
|
4 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
5 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
6 |
|
|
'\"
|
7 |
|
|
'\" @(#) scopedobject.n 1.21 97/1/30 16:04:44
|
8 |
|
|
'/"
|
9 |
|
|
.so man.macros
|
10 |
|
|
.HS scopedobject iwid
|
11 |
|
|
.BS
|
12 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
13 |
|
|
.SH NAME
|
14 |
|
|
scopedobject \- Create and manipulate a scoped \[incr Tcl\] class object.
|
15 |
|
|
.SH SYNOPSIS
|
16 |
|
|
\fBscopedobject\fI \fIobjName \fR?\fIoptions\fR?
|
17 |
|
|
.SH "INHERITANCE"
|
18 |
|
|
None
|
19 |
|
|
.SH "STANDARD OPTIONS"
|
20 |
|
|
.LP
|
21 |
|
|
.nf
|
22 |
|
|
Name: \fBenterscopecommand:\fR
|
23 |
|
|
Command-Line Switch: \fB-enterscopecommand\fR
|
24 |
|
|
.fi
|
25 |
|
|
.IP
|
26 |
|
|
Specifies a Tcl command to invoke when an object enters scope
|
27 |
|
|
(i.e. when it is created..). The default is {}.
|
28 |
|
|
.LP
|
29 |
|
|
.nf
|
30 |
|
|
Name: \fBenterscopecommand:\fR
|
31 |
|
|
Command-Line Switch: \fB-enterscopecommand\fR
|
32 |
|
|
.fi
|
33 |
|
|
.IP
|
34 |
|
|
Specifies a Tcl command to invoke when an object exits scope
|
35 |
|
|
(i.e. when it is deleted..). The default is {}.
|
36 |
|
|
.LP
|
37 |
|
|
.BE
|
38 |
|
|
|
39 |
|
|
.SH DESCRIPTION
|
40 |
|
|
.PP
|
41 |
|
|
The \fBscopedobject\fR command creates a base class for defining
|
42 |
|
|
Itcl classes which posses scoped behavior like Tcl variables.
|
43 |
|
|
The objects are only accessible within the procedure in which
|
44 |
|
|
they are instantiated and are deleted when the procedure returns.
|
45 |
|
|
This class was designed to be a general purpose base class for
|
46 |
|
|
supporting scoped incr Tcl classes. The options include the
|
47 |
|
|
execute a Tcl script command when an object enters and exits its
|
48 |
|
|
scope.
|
49 |
|
|
.SH "METHODS"
|
50 |
|
|
.PP
|
51 |
|
|
The \fBscopedobject\fR command creates a new Tcl command whose
|
52 |
|
|
name is \fIpathName\fR. This
|
53 |
|
|
command may be used to invoke various operations on the object.
|
54 |
|
|
It has the following general form:
|
55 |
|
|
.DS C
|
56 |
|
|
\fIpathName option \fR?\fIarg arg ...\fR?
|
57 |
|
|
.DE
|
58 |
|
|
\fIOption\fR and the \fIarg\fRs
|
59 |
|
|
determine the exact behavior of the command. The following
|
60 |
|
|
commands are possible for scopedobject objects:
|
61 |
|
|
.SH "OBJECT-SPECIFIC METHODS"
|
62 |
|
|
.TP
|
63 |
|
|
\fIpathName \fBcget\fR \fIoption\fR
|
64 |
|
|
Returns the current value of the configuration option given
|
65 |
|
|
by \fIoption\fR.
|
66 |
|
|
\fIOption\fR may have any of the values accepted by the \fBscopedobject\fR
|
67 |
|
|
command.
|
68 |
|
|
.TP
|
69 |
|
|
\fIpathName\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
|
70 |
|
|
Query or modify the configuration options of the object.
|
71 |
|
|
If no \fIoption\fR is specified, returns a list describing all of
|
72 |
|
|
the available options for \fIpathName\fR. If \fIoption\fR is specified
|
73 |
|
|
with no \fIvalue\fR, then the command returns a list describing the
|
74 |
|
|
one named option (this list will be identical to the corresponding
|
75 |
|
|
sublist of the value returned if no \fIoption\fR is specified). If
|
76 |
|
|
one or more \fIoption\-value\fR pairs are specified, then the command
|
77 |
|
|
modifies the given objects option(s) to have the given value(s); in
|
78 |
|
|
this case the command returns an empty string.
|
79 |
|
|
\fIOption\fR may have any of the values accepted by the \fBscopedobject\fR
|
80 |
|
|
command.
|
81 |
|
|
|
82 |
|
|
.SH EXAMPLE
|
83 |
|
|
.IP
|
84 |
|
|
The scopedobject was primarily meant to be a base class. The
|
85 |
|
|
following is an example of usage without inheritance:
|
86 |
|
|
.LP
|
87 |
|
|
.DS
|
88 |
|
|
proc scopedobject_demo {} {
|
89 |
|
|
scopedobject #auto \
|
90 |
|
|
-exitscopecommand {puts "enter scopedobject_demo"} \
|
91 |
|
|
-exitscopecommand {puts "exit scopedobject_demo"}
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
scopedobject_demo
|
95 |
|
|
|
96 |
|
|
.DE
|
97 |
|
|
.SH AUTHOR
|
98 |
|
|
John A. Tucker
|
99 |
|
|
.SH KEYWORDS
|
100 |
|
|
scopedobject, object
|