| 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>option (GCL TK Manual)</title> |
| 7 |
|
| 8 |
<meta name="description" content="option (GCL TK Manual)"> |
| 9 |
<meta name="keywords" content="option (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="Control.html" rel="up" title="Control"> |
| 16 |
<link href="options.html" rel="next" title="options"> |
| 17 |
<link href="tk_002dmenu_002dbar.html" rel="prev" title="tk-menu-bar"> |
| 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="option"></span><div class="header"> |
| 42 |
<p> |
| 43 |
Next: <a href="options.html" accesskey="n" rel="next">options</a>, Previous: <a href="tk_002dmenu_002dbar.html" accesskey="p" rel="prev">tk-menu-bar</a>, Up: <a href="Control.html" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 44 |
</div> |
| 45 |
<hr> |
| 46 |
<span id="option-1"></span><h3 class="section">3.11 option</h3> |
| 47 |
|
| 48 |
<p>option \- Add/retrieve window options to/from the option database |
| 49 |
</p><span id="Synopsis-25"></span><h4 class="unnumberedsubsec">Synopsis</h4> |
| 50 |
<p><b>option :add </b><i>pattern value </i><span class="roman">?</span><i>priority</i>? |
| 51 |
</p><br> |
| 52 |
<p><b>option :clear</b> |
| 53 |
</p><br> |
| 54 |
<p><b>option :get </b><i>window name class</i> |
| 55 |
</p><br> |
| 56 |
<p><b>option :readfile </b><i>fileName </i><span class="roman">?</span><i>priority</i>? |
| 57 |
</p> |
| 58 |
<span id="Description-22"></span><h4 class="unnumberedsubsec">Description</h4> |
| 59 |
|
| 60 |
<p>The <b>option</b> command allows you to add entries to the Tk option |
| 61 |
database or to retrieve options from the database. The <b>add</b> |
| 62 |
form of the command adds a new option to the database. |
| 63 |
<i>Pattern</i> contains |
| 64 |
the option being specified, and consists of names and/or classes |
| 65 |
separated by asterisks or dots, in the usual X format. <i>Value</i> |
| 66 |
contains a text string to associate with <i>pattern</i>; this is the |
| 67 |
value that will be returned in calls to <b>Tk_GetOption</b> or by |
| 68 |
invocations of the <b>option :get</b><span class="roman"> command. If </span><i>priority</i> |
| 69 |
is specified, it indicates the priority level for this option (see |
| 70 |
below for legal values); it defaults to <b>interactive</b>. |
| 71 |
This command always returns an empty string. |
| 72 |
</p> |
| 73 |
<p>The <b>option :clear</b> command clears the option database. Default |
| 74 |
options (in the |
| 75 |
<b>RESOURCE_MANAGER</b><span class="roman"> property or the </span><b>.Xdefaults</b> |
| 76 |
file) will be reloaded automatically the next time an |
| 77 |
option is added to the database or removed from it. This command |
| 78 |
always returns an empty string. |
| 79 |
</p> |
| 80 |
<p>The <b>option :get</b> command returns the value of the option |
| 81 |
specified for <i>window</i> |
| 82 |
under <i>name</i><span class="roman"> and </span><i>class</i>. If several entries in the option |
| 83 |
database match <i>window</i><span class="roman">, </span><i>name</i><span class="roman">, and </span><i>class</i>, then |
| 84 |
the command returns whichever was created with highest |
| 85 |
<i>priority</i> level. If there are several matching |
| 86 |
entries at the same priority level, then it returns whichever entry |
| 87 |
was most recently entered into the option database. If there are |
| 88 |
no matching entries, then the empty string is returned. |
| 89 |
</p> |
| 90 |
<p>The <b>readfile</b><span class="roman"> form of the command reads </span><i>fileName</i>, |
| 91 |
which should have the standard format for an |
| 92 |
X resource database such as <b>.Xdefaults</b>, and adds all the |
| 93 |
options specified in that file to the option database. If <i>priority</i> |
| 94 |
is specified, it indicates the priority level at which to enter the |
| 95 |
options; <i>priority</i><span class="roman"> defaults to </span><b>interactive</b>. |
| 96 |
</p> |
| 97 |
<p>The <i>priority</i><span class="roman"> arguments to the </span><b>option</b> command are |
| 98 |
normally specified symbolically using one of the following values: |
| 99 |
</p> |
| 100 |
<dl compact="compact"> |
| 101 |
<dt><b>widgetDefault</b></dt> |
| 102 |
<dd><p>Level 20. Used for default values hard-coded into widgets. |
| 103 |
</p></dd> |
| 104 |
<dt><b>startupFile</b></dt> |
| 105 |
<dd><p>Level 40. Used for options specified in application-specific |
| 106 |
startup files. |
| 107 |
</p></dd> |
| 108 |
<dt><b>userDefault</b></dt> |
| 109 |
<dd><p>Level 60. Used for options specified in user-specific defaults |
| 110 |
files, such as <b>.Xdefaults</b>, resource databases loaded into |
| 111 |
the X server, or user-specific startup files. |
| 112 |
</p></dd> |
| 113 |
<dt><b>interactive</b></dt> |
| 114 |
<dd><p>Level 80. Used for options specified interactively after the application |
| 115 |
starts running. If <i>priority</i> isn’t specified, it defaults to |
| 116 |
this level. |
| 117 |
</p></dd> |
| 118 |
</dl> |
| 119 |
|
| 120 |
|
| 121 |
<p>Any of the above keywords may be abbreviated. In addition, priorities |
| 122 |
may be specified numerically using integers between 0 and 100, |
| 123 |
inclusive. The numeric form is probably a bad idea except for new priority |
| 124 |
levels other than the ones given above. |
| 125 |
</p> |
| 126 |
<span id="Keywords-25"></span><h4 class="unnumberedsubsec">Keywords</h4> |
| 127 |
<p>database, option, priority, retrieve |
| 128 |
</p><hr> |
| 129 |
<div class="header"> |
| 130 |
<p> |
| 131 |
Next: <a href="options.html" accesskey="n" rel="next">options</a>, Previous: <a href="tk_002dmenu_002dbar.html" accesskey="p" rel="prev">tk-menu-bar</a>, Up: <a href="Control.html" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 132 |
</div> |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
</body> |
| 137 |
</html> |