Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 4a0a3d2c41a3220630917306c0b7fefa > files > 121

gcl-2.6.8-0.13.20130121cvs.fc18.i686.rpm

<html lang="en">
<head>
<title>Argument Lists - GCL TK Manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GCL TK Manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="General.html#General" title="General">
<link rel="prev" href="Return-Values.html#Return-Values" title="Return Values">
<link rel="next" href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics" title="Lisp Functions Invoked from Graphics">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Argument-Lists"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Lisp-Functions-Invoked-from-Graphics.html#Lisp-Functions-Invoked-from-Graphics">Lisp Functions Invoked from Graphics</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Return-Values.html#Return-Values">Return Values</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="General.html#General">General</a>
<hr>
</div>

<h3 class="section">1.5 Argument Lists</h3>

<h4 class="subsection">1.5.1 Widget Functions</h4>

<p>The rule is that the first argument for a widget function is a keyword,
called the <i>option</i>.  The pattern of the remaining arguments depends
completely
on the <i>option</i> argument.  Thus

<pre class="example">     (.hello <i>option</i> ?arg1? ?arg2? ...)
</pre>
   <p>One <i>option</i> which is permitted for every widget function is
<code>:configure</code>.  The argument pattern following it is the same
keyword/value pair list which is used in widget creation.  For a
<code>button</code> widget, the other valid options are <code>:deactivate</code>,
<code>:flash</code>, and <code>:invoke</code>.   To find these, since
<code>.hello</code> was constructed with the <code>button</code> constructor, you
should see See <a href="button.html#button">button</a>. 
The argument pattern for other options depends completely on the option
and the widget function. 
For example if <code>.scrollbar</code> is a scroll bar window, then the option
<code>:set</code> must be followed by 4 numeric arguments, which indicate how
the scrollbar should be displayed, see See <a href="scrollbar.html#scrollbar">scrollbar</a>.

<pre class="example">     (.scrollbar :set a1 a2 a3 a4)
</pre>
   <p>If on the other hand <code>.scale</code> is a scale (see <a href="scale.html#scale">scale</a>), then we have

<pre class="example">     (.scale :set a1 )
</pre>
   <p class="noindent">only one numeric argument should be supplied, in order to position the
scale.

<h4 class="subsection">1.5.2 Widget Constructor Argument Lists</h4>

<p>These are

<pre class="example">     (widget-constructor <i>pathname</i> :keyword1 value1 :keyword2 value2 ...)
</pre>
   <p class="noindent">to create the widget whose name is <i>pathname</i>.  The possible keywords
allowed are specified in the corresponding section of See <a href="Widgets.html#Widgets">Widgets</a>.

<h4 class="subsection">1.5.3 Concatenation Using `:' in Argument List</h4>

<p>What has been said so far about arguments is not quite true.  A
special string concatenation construction is allowed in argument lists
for widgets, widget constructors and control functions.

   <p>First we introduce the function <code>tk-conc</code> which takes an arbitrary
number of arguments, which may be symbols, strings or numbers, and
concatenates these into a string.   The print names of symbols are
converted to lower case, and package names are ignored.

<pre class="example">     (tk-conc "a" 1 :b 'cd "e") ==&gt; "a1bcde"
</pre>
   <p>One could use <code>tk-conc</code> to construct arguments for widget
functions.  But even though <code>tk-conc</code> has been made quite
efficient, it still would involve the creation of a string.   The
<code>:</code> construct avoids this.   In a call to a widget function,
a widget constructor, or a control function you may remove the call to
<code>tk-conc</code> and place <code>:</code> in between each of its arguments. 
Those functions are able to understand this and treat the extra
arguments as if they were glued together in one string, but without
the extra cost of actually forming that string.

<pre class="example">     (tk-conc a b c .. w) &lt;==&gt; a : b : c : ... w
     (setq i 10)
     (.hello :configure :text i : " pies")
     (.hello :configure :text (tk-conc i  " pies"))
     (.hello :configure :text (format nil "~a pies" i))
</pre>
   <p>The last three examples would all result in the text string being
<code>"10 pies"</code>, but the first method is the most efficient. 
That call will be made with no string or cons creation.   The
<b>GC Monitor</b> example, is written in such a way that there is no
creation of <code>cons</code> or <code>string</code> types during normal operation. 
This is particularly useful in that case, since one is trying to
monitor usage of conses by other programs, not its own usage.

   </body></html>