stk/Help/option.n.html

81 lines
3.7 KiB
HTML

<HTML><HEAD><TITLE>Tk Built-In Commands - option manual page</TITLE></HEAD>
<BODY bgcolor = #c3c3ff>
<H2><IMG ALIGN=BOTTOM SRC="./Img/ManPageBlue.gif"> option</H2>
<I>Add/retrieve window options to/from the option database</I><P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
<H3><A NAME="M2">SYNOPSIS</A></H3>
(<B>option 'add </B><I>pattern value</I>)<BR>
(<B>option 'add </B><I>pattern value </I><I>priority</I>)<BR>
(<B>option 'clear</B>)<BR>
(<B>option 'get </B><I>window name class</I>)<BR>
(<B>option 'readfile </B><I>fileName </I>?<I>priority</I>?)<BR>
(<B>option 'readfile </B><I>fileName </I><I>priority</I>)<BR>
<H3><A NAME="M3">DESCRIPTION</A></H3>
The <B>option</B> procedure allows you to add entries to the Tk option
database or to retrieve options from the database. The <B>add</B>
form of the procedure adds a new option to the database.
<I>Pattern</I> contains
the option being specified, and consists of names and/or classes
separated by asterisks or dots, in the usual X format. <I>Value</I>
contains a text string to associate with <I>pattern</I>; this is the
value that will be returned in calls to <B>Tk_GetOption</B> or by
invocations of the <B>option get</B> procedure. If <I>priority</I>
is specified, it indicates the priority level for this option (see
below for legal values); it defaults to <B>interactive</B>.
This procedure always returns an empty list.
<P>
The <B>option clear</B> procedure clears the option database. Default
options (from the
<B>RESOURCE_MANAGER</B> property or the <B>.Xdefaults</B>
file) will be reloaded automatically the next time an
option is added to the database or removed from it. This procedure
always returns an empty string.
<P>
The <B>option get</B> procedure returns the value of the option
specified for <I>window</I>
under <I>name</I> and <I>class</I>. If several entries in the option
database match <I>window</I>, <I>name</I>, and <I>class</I>, then
the procedure returns whichever was created with highest
<I>priority</I> level. If there are several matching
entries at the same priority level, then it returns whichever entry
was most recently entered into the option database. If there are
no matching entries, then the empty string is returned.
<P>
The <B>readfile</B> form of the procedure reads <I>fileName</I>,
which should have the standard format for an
X resource database such as <B>.Xdefaults</B>, and adds all the
options specified in that file to the option database. If <I>priority</I>
is specified, it indicates the priority level at which to enter the
options; <I>priority</I> defaults to <B>interactive</B>.
<P>
The <I>priority</I> arguments to the <B>option</B> procedure are
normally specified symbolically using one of the following values:
<P>
<DL>
<DT><A NAME="M4"><B>widgetDefault</B></A><DD>
Level 20. Used for default values hard-coded into widgets.
<P>
<DT><A NAME="M5"><B>startupFile</B></A><DD>
Level 40. Used for options specified in application-specific
startup files.
<P>
<DT><A NAME="M6"><B>userDefault</B></A><DD>
Level 60. Used for options specified in user-specific defaults
files, such as <B>.Xdefaults</B>, resource databases loaded into
the X server, or user-specific startup files.
<P>
<DT><A NAME="M7"><B>interactive</B></A><DD>
Level 80. Used for options specified interactively after the application
starts running. If <I>priority</I> isn't specified, it defaults to
this level.
<P>
</DL>
<P>
Any of the above keywords may be abbreviated. In addition, priorities
may be specified numerically using integers between 0 and 100,
inclusive. The numeric form is probably a bad idea except for new priority
levels other than the ones given above.
<P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
<A HREF=./STk-hlp.html><IMG ALIGN=BOTTOM SRC="./Img/RefBookBlue.gif"> Back to the <B>STk</B> main page</A>
</BODY></HTML>