Debian Codegraph @

info/gcl-tk/Argument-Lists.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>Argument Lists (GCL TK Manual)</title>
7
8 <meta name="description" content="Argument Lists (GCL TK Manual)">
9 <meta name="keywords" content="Argument Lists (GCL TK Manual)">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="index.html" rel="start" title="Top">
14 <link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
15 <link href="General.html" rel="up" title="General">
16 <link href="Lisp-Functions-Invoked-from-Graphics.html" rel="next" title="Lisp Functions Invoked from Graphics">
17 <link href="Return-Values.html" rel="prev" title="Return Values">
18 <style type="text/css">
19 <!--
20 a.summary-letter {text-decoration: none}
21 blockquote.indentedblock {margin-right: 0em}
22 div.display {margin-left: 3.2em}
23 div.example {margin-left: 3.2em}
24 div.lisp {margin-left: 3.2em}
25 kbd {font-style: oblique}
26 pre.display {font-family: inherit}
27 pre.format {font-family: inherit}
28 pre.menu-comment {font-family: serif}
29 pre.menu-preformatted {font-family: serif}
30 span.nolinebreak {white-space: nowrap}
31 span.roman {font-family: initial; font-weight: normal}
32 span.sansserif {font-family: sans-serif; font-weight: normal}
33 ul.no-bullet {list-style: none}
34 -->
35 </style>
36
37
38 </head>
39
40 <body lang="en">
41 <span id="Argument-Lists"></span><div class="header">
42 <p>
43 Next: <a href="Lisp-Functions-Invoked-from-Graphics.html" accesskey="n" rel="next">Lisp Functions Invoked from Graphics</a>, Previous: <a href="Return-Values.html" accesskey="p" rel="prev">Return Values</a>, Up: <a href="General.html" accesskey="u" rel="up">General</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
44 </div>
45 <hr>
46 <span id="Argument-Lists-1"></span><h3 class="section">1.5 Argument Lists</h3>
47
48 <span id="Widget-Functions"></span><h4 class="subsection">1.5.1 Widget Functions</h4>
49
50 <p>The rule is that the first argument for a widget function is a keyword,
51 called the <i>option</i>. The pattern of the remaining arguments depends
52 completely
53 on the <i>option</i> argument. Thus
54 </p>
55 <div class="example">
56 <pre class="example">(.hello <i>option</i> ?arg1? ?arg2? ...)
57 </pre></div>
58
59 <p>One <i>option</i> which is permitted for every widget function is
60 <code>:configure</code>. The argument pattern following it is the same
61 keyword/value pair list which is used in widget creation. For a
62 <code>button</code> widget, the other valid options are <code>:deactivate</code>,
63 <code>:flash</code>, and <code>:invoke</code>. To find these, since
64 <code>.hello</code> was constructed with the <code>button</code> constructor, you
65 should see See <a href="button.html">button</a>.
66 The argument pattern for other options depends completely on the option
67 and the widget function.
68 For example if <code>.scrollbar</code> is a scroll bar window, then the option
69 <code>:set</code> must be followed by 4 numeric arguments, which indicate how
70 the scrollbar should be displayed, see See <a href="scrollbar.html">scrollbar</a>.
71 </p>
72 <div class="example">
73 <pre class="example">(.scrollbar :set a1 a2 a3 a4)
74 </pre></div>
75
76 <p>If on the other hand <code>.scale</code> is a scale (see <a href="scale.html">scale</a>), then we have
77 </p>
78 <div class="example">
79 <pre class="example">(.scale :set a1 )
80 </pre></div>
81 <p>only one numeric argument should be supplied, in order to position the
82 scale.
83 </p>
84 <span id="Widget-Constructor-Argument-Lists"></span><h4 class="subsection">1.5.2 Widget Constructor Argument Lists</h4>
85
86 <p>These are
87 </p>
88 <div class="example">
89 <pre class="example">(widget-constructor <i>pathname</i> :keyword1 value1 :keyword2 value2 ...)
90 </pre></div>
91
92 <p>to create the widget whose name is <i>pathname</i>. The possible keywords
93 allowed are specified in the corresponding section of See <a href="Widgets.html">Widgets</a>.
94 </p>
95 <span id="Concatenation-Using-_0060_003a_0027-in-Argument-List"></span><h4 class="subsection">1.5.3 Concatenation Using &lsquo;:&rsquo; in Argument List</h4>
96
97 <p>What has been said so far about arguments is not quite true. A
98 special string concatenation construction is allowed in argument lists
99 for widgets, widget constructors and control functions.
100 </p>
101 <p>First we introduce the function <code>tk-conc</code> which takes an arbitrary
102 number of arguments, which may be symbols, strings or numbers, and
103 concatenates these into a string. The print names of symbols are
104 converted to lower case, and package names are ignored.
105 </p>
106 <div class="example">
107 <pre class="example">(tk-conc &quot;a&quot; 1 :b 'cd &quot;e&quot;) ==&gt; &quot;a1bcde&quot;
108 </pre></div>
109
110 <p>One could use <code>tk-conc</code> to construct arguments for widget
111 functions. But even though <code>tk-conc</code> has been made quite
112 efficient, it still would involve the creation of a string. The
113 <code>:</code> construct avoids this. In a call to a widget function,
114 a widget constructor, or a control function you may remove the call to
115 <code>tk-conc</code> and place <code>:</code> in between each of its arguments.
116 Those functions are able to understand this and treat the extra
117 arguments as if they were glued together in one string, but without
118 the extra cost of actually forming that string.
119 </p>
120 <div class="example">
121 <pre class="example">(tk-conc a b c .. w) &lt;==&gt; a : b : c : ... w
122 (setq i 10)
123 (.hello :configure :text i : &quot; pies&quot;)
124 (.hello :configure :text (tk-conc i &quot; pies&quot;))
125 (.hello :configure :text (format nil &quot;~a pies&quot; i))
126 </pre></div>
127
128 <p>The last three examples would all result in the text string being
129 <code>&quot;10 pies&quot;</code>, but the first method is the most efficient.
130 That call will be made with no string or cons creation. The
131 <b>GC Monitor</b> example, is written in such a way that there is no
132 creation of <code>cons</code> or <code>string</code> types during normal operation.
133 This is particularly useful in that case, since one is trying to
134 monitor usage of conses by other programs, not its own usage.
135 </p>
136 <hr>
137 <div class="header">
138 <p>
139 Next: <a href="Lisp-Functions-Invoked-from-Graphics.html" accesskey="n" rel="next">Lisp Functions Invoked from Graphics</a>, Previous: <a href="Return-Values.html" accesskey="p" rel="prev">Return Values</a>, Up: <a href="General.html" accesskey="u" rel="up">General</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
140 </div>
141
142
143
144 </body>
145 </html>