1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
<title>UI PARAMETER class</title>
<h1><IMG SRC="/iraf/web/images/iraf.gif"> UI PARAMETER class</h1>
<p>
<HR>
<p>
The UI parameter class is used for client-UI communications. The client
does not control the user interface directly, rather the UI defines a set
of abstract UI parameters, and during execution the client application
assigns values to these parameters. These UI parameters should be thought
of as describing the runtime state of the client as viewed by the GUI.
The GUI is free to interpret this state information in any way, including
ignoring it. Many GUIs can be written which use the same client state
as described by the UI parameters.
<p>
Assigning a value to a UI parameter causes the new value to be stored, and
any parameter action procedures registered by the UI to be called.
The action or actions [if any] taken when a parameter value changes are
arbitrary, e.g. the action might be something as simple as changing a
displayed value of a UI widget, or something more complex like displaying
a popup.
<p>
UI Parameter class commands:
<p>
<pre>
<a href="#getValue">getValue</a>
<a href="#setValue">setValue</a> <new-value>
<a href="#addCallback">addCallback</a> <procedure-name>
<a href="#deleteCallback">deleteCallback</a> <procedure-name>
<a href="#notify">notify</a>
</pre>
<p>
The most common usage is for the GUI to post one or more callbacks for
each UI parameter. When the UI parameter value is changed [with setValue,
e.g. by the client] the GUI callback procedures are called with the old
and new UI parameter values on the command line. addCallback is used to
add a callback procedure, and deleteCallback to delete one. Multiple
callbacks may be registered for a single UI parameter. notify is used
to simulate a parameter value change, causing any callback procedures to
be invoked.
<p>
The callback procedure is called as follows:
<p>
<pre>
user-procedure param-name {old-value} {new-value}
</pre>
<p>
The important thing to note here is that the old and new value strings
are quoted with braces. This prevents any interpretation of the string
by Tcl when the callback is executed, which is necessary because the
strings can contain arbitrary data. When Tcl calls the callback the
first level of braces will be stripped off, leaving old-value and new-value
each as a single string argument.
<p>
<p>
<h2><A NAME="setValue">setValue</A></h2>
<p>
Set the value of a parameter, and notify all clients
via the posted callback procedures that the parameter value has changed.
<p>
Usage:
<p>
<pre>
setValue <new-value>
</pre>
<p>
<h2><A NAME="getValue">getValue</A></h2>
<p>
Get the value of a parameter.
<p>
Usage:
<p>
<pre>
getValue
</pre>
<p>
<h2><A NAME="notify">notify</A></h2>
<p>
Notify the registered clients of a parameter as if the
value had changed.
<p>
Usage:
<p>
<pre>
notify
</pre>
<p>
<h2><A NAME="addCallback">addCallback</A></h2>
<p>
Add a callback procedure to the callback list for
a parameter.
<p>
Usage:
<p>
<pre>
addCallback <procedure-name>
</pre>
<p>
<h2><A NAME="deleteCallback">deleteCallback</A></h2>
<p>
Delete a callback procedure previously registered
for a parameter.
<p>
Usage:
<p>
<pre>
deleteCallback <procedure-name>
</pre>
|