File: node56.html

package info (click to toggle)
dotfile-doc 2.0-1
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 616 kB
  • ctags: 690
  • sloc: makefile: 31; tcl: 22
file content (98 lines) | stat: -rw-r--r-- 4,679 bytes parent folder | download | duplicates (2)
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
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
<!--Converted with LaTeX2HTML 96.1 (Feb 5, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>Referencing variables in other configuration files</TITLE>
<META NAME="description" CONTENT="Referencing variables in other configuration files">
<META NAME="keywords" CONTENT="dotdotfiles">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="dotdotfiles.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" LANG="EN">
 <a href="index.html"><img align=right border=0 src=Graphics/gray-g3.gif></a><A NAME="tex2html799" HREF="node57.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="Graphics/next_motif.gif"></A> <A NAME="tex2html797" HREF="dotdotfiles.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="Graphics/up_motif.gif"></A> <A NAME="tex2html791" HREF="node55.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="Graphics/previous_motif.gif"></A> <A NAME="tex2html801" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="Graphics/contents_motif.gif"></A>  <BR>
<B> Next:</B> <A NAME="tex2html800" HREF="node57.html">Initialization of dotdotfiles</A>
<B>Up:</B> <A NAME="tex2html798" HREF="dotdotfiles.html">   dotdot files</A>
<B> Previous:</B> <A NAME="tex2html792" HREF="node55.html">Example</A>
<BR> <HR> <P>
<H1><A NAME="SECTION00080000000000000000">Referencing variables in other configuration files</A></H1>
<P>
<A NAME="refering_vars_on_other_pages">&#160;</A>
In the
<A HREF="node45.html#Init">Init function</A>,
<A HREF="node44.html#Change">Change function</A>,
<A HREF="node46.html#PageEnd">PageEnd function</A>,
<A HREF="node48.html#ShowPage">ShowPage function</A> and
<A HREF="node52.html#Save">save function</A> it
is possible to <EM>see</EM> variables from other configuration
pages. This means that you can read and write them, and
enable/disable the elements they belong to.
<P>
<H3><A NAME="SECTION00080100000000000000">Ordinary variables</A></H3>
<P>
The variables are referred to as <EM>function name</EM>@<EM>variable
name</EM>. If you eg. have a variable called count on the menupage backup,
then you can do the following:
<UL><LI> <code>set backup@count 1</code><LI> if <code>{${backup@count} == 1} {...}</code><LI> <code>Disable backup@count</code>
</UL>
Remember braces arround the variable name, when you read, since @ is a
variable delimiter in TCL.
<P>
If the variable is an associative array (
<A HREF="node23.html#Menu">Menu</A>,
<A HREF="node24.html#Radio">Radio</A>,
<A HREF="node22.html#ListBox">ListBox</A>),
<A HREF="node11.html#ComboBox">ComboBox</A>
the TCL syntax is a bit different, when you <EM>read</EM> the variable:
<UL><LI> <code>if {[set backup@count(index)] == 1} {...}</code>
</UL><H3><A NAME="SECTION00080200000000000000">Variable in extentries</A></H3>
<P>
If the variable is in an extended entry, you have to do a forevery on
the variable with the <EM>function@</EM> prefix, and the variables will
be named with the <EM>function@</EM> prefix too.  If we say we have an
extentry called <EM>alias</EM> on the menupage <EM>misc</EM>, and it
consists of <EM>name</EM> and <EM>value</EM>, then it could look like this:
<PRE>  forevery misc@alias {
    if {${misc@name} == &quot;&quot;} {
      Disable misc@value
    }
  }</PRE>
<P>
<H3><A NAME="SECTION00080300000000000000">Variable in fillOut</A></H3>
<P>
If you want to refer to a fillOut element on another page, the save,
change, pageEnd and init functions, foreach fillOutElm, have to be a bit
different from what we already have learned.
<P>
Instead of just referring to the variable, you have to write <TT>[expand</TT> <EM>
variable_name</EM><TT>]</TT> and for associative arrays <TT>[expand</TT> <EM>
variable_name variable_index</EM><TT>]</TT>. Here's an example which will
clarify the matter.
<PRE>  CheckBox checkbox -text &quot;Just a checkbox&quot;
  Radio radio \
    -text radio -entries { &quot;option 1&quot; &quot;option 2&quot;}

  FillOutElm fill -entries checkbox radio \
    -save {
      if {[expand checkbox] == 1} {
        print &quot;radio = [expand radio name]&quot;
      }
    }</PRE>
<P>
If referencing to this page wasn't nessecary, you could just have
written:
<P>
<PRE>  FillOutElm fill -entries checkbox radio \
    -save {
      if {$checkbox == 1} {
        print &quot;radio = $radio(name)&quot;
      }
    }</PRE>
<P>
<BR> <HR>
<P><ADDRESS>
<a href="http://www.imada.ou.dk/~blackie/">Jesper Kj&aelig;r Pedersen</a> &lt;<a href="mailto:blackie@imada.ou.dk">blackie@imada.ou.dk</a>&gt;<BR>
Wed Oct  2 13:29:53 MET DST 1996
</ADDRESS>
</BODY>
</HTML>