option.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
- '"
- '" Copyright (c) 1990 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: option.n,v 1.2.26.1 2004/10/28 12:25:22 dkf Exp $
- '"
- .so man.macros
- .TH option n "" Tk "Tk Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- option - Add/retrieve window options to/from the option database
- .SH SYNOPSIS
- .nf
- fBoption add fIpattern value fR?fIpriorityfR?
- fBoption clearfR
- fBoption get fIwindow name classfR
- fBoption readfile fIfileName fR?fIpriorityfR?
- .fi
- .BE
- .SH DESCRIPTION
- .PP
- The fBoptionfR command allows you to add entries to the Tk option
- database or to retrieve options from the database. The fBaddfR
- form of the command adds a new option to the database.
- fIPatternfR contains
- the option being specified, and consists of names and/or classes
- separated by asterisks or dots, in the usual X format. fIValuefR
- contains a text string to associate with fIpatternfR; this is the
- value that will be returned in calls to fBTk_GetOptionfR or by
- invocations of the fBoption getfR command. If fIpriorityfR
- is specified, it indicates the priority level for this option (see
- below for legal values); it defaults to fBinteractivefR.
- This command always returns an empty string.
- .PP
- The fBoption clearfR command clears the option database. Default
- options (from the
- fBRESOURCE_MANAGERfR property or the fB.XdefaultsfR
- file) will be reloaded automatically the next time an
- option is added to the database or removed from it. This command
- always returns an empty string.
- .PP
- The fBoption getfR command returns the value of the option
- specified for fIwindowfR
- under fInamefR and fIclassfR. If several entries in the option
- database match fIwindowfR, fInamefR, and fIclassfR, then
- the command returns whichever was created with highest
- fIpriorityfR 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.
- .PP
- The fBreadfilefR form of the command reads fIfileNamefR,
- which should have the standard format for an
- X resource database such as fB.XdefaultsfR, and adds all the
- options specified in that file to the option database. If fIpriorityfR
- is specified, it indicates the priority level at which to enter the
- options; fIpriorityfR defaults to fBinteractivefR.
- .PP
- The fIpriorityfR arguments to the fBoptionfR command are
- normally specified symbolically using one of the following values:
- .TP
- fBwidgetDefaultfR
- Level 20. Used for default values hard-coded into widgets.
- .TP
- fBstartupFilefR
- Level 40. Used for options specified in application-specific
- startup files.
- .TP
- fBuserDefaultfR
- Level 60. Used for options specified in user-specific defaults
- files, such as fB.XdefaultsfR, resource databases loaded into
- the X server, or user-specific startup files.
- .TP
- fBinteractivefR
- Level 80. Used for options specified interactively after the application
- starts running. If fIpriorityfR isn't specified, it defaults to
- this level.
- .LP
- 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.
- .SH EXAMPLES
- Instruct every button in the application to have red text on it unless
- explicitly overridden:
- .CS
- fBoption addfR *button.foreground red startupFile
- .CE
- .PP
- Allow users to control what happens in an entry widget when the Return
- key is pressed by specifying a script in the option database and add a
- default option for that which rings the bell:
- .CS
- entry .e
- bind .e <Return> [fBoption getfR .e returnCommand Command]
- fBoption addfR *.e.returnCommand bell widgetDefault
- .CE
- .SH KEYWORDS
- database, option, priority, retrieve