Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "CMDLINE 1" | |
132 | .TH CMDLINE 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Tk::CmdLine \- Process standard X11 command line options and set initial resources | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& Tk::CmdLine::SetArguments([@argument]); | |
139 | .Ve | |
140 | .PP | |
141 | .Vb 1 | |
142 | \& my $value = Tk::CmdLine::cget([$option]); | |
143 | .Ve | |
144 | .PP | |
145 | .Vb 1 | |
146 | \& Tk::CmdLine::SetResources((\e@resource | $resource) [, $priority]); | |
147 | .Ve | |
148 | .PP | |
149 | .Vb 5 | |
150 | \& Tk::CmdLine::LoadResources( | |
151 | \& [ -symbol => $symbol ] | |
152 | \& [ -file => $fileSpec ] | |
153 | \& [ -priority => $priority ] | |
154 | \& [ -echo => $fileHandle ] ); | |
155 | .Ve | |
156 | .SH "DESCRIPTION" | |
157 | .IX Header "DESCRIPTION" | |
158 | Process standard X11 command line options and set initial resources. | |
159 | .PP | |
160 | The X11R5 man page for X11 says: \*(L"Most X programs attempt to use the same names | |
161 | for command line options and arguments. All applications written with the | |
162 | X Toolkit Intrinsics automatically accept the following options: ...\*(R". | |
163 | This module processes these command line options for perl/Tk applications | |
164 | using the \f(CW\*(C`SetArguments\*(C'\fR function. | |
165 | .PP | |
166 | This module can optionally be used to load initial resources explicitly via | |
167 | function \f(CW\*(C`SetResources\*(C'\fR, or from specified files (default: the standard X11 | |
168 | application-specific resource files) via function \f(CW\*(C`LoadResources\*(C'\fR. | |
169 | .Sh "Command Line Options" | |
170 | .IX Subsection "Command Line Options" | |
171 | .IP "\fB\-background\fR \fIColor\fR | \fB\-bg\fR \fIColor\fR" 4 | |
172 | .IX Item "-background Color | -bg Color" | |
173 | Specifies the color to be used for the window background. | |
174 | .IP "\fB\-class\fR \fIClass\fR" 4 | |
175 | .IX Item "-class Class" | |
176 | Specifies the class under which resources for the application should be found. | |
177 | This option is useful in shell aliases to distinguish between invocations | |
178 | of an application, without resorting to creating links to alter the executable | |
179 | file name. | |
180 | .IP "\fB\-display\fR \fIDisplay\fR | \fB\-screen\fR \fIDisplay\fR" 4 | |
181 | .IX Item "-display Display | -screen Display" | |
182 | Specifies the name of the X server to be used. | |
183 | .IP "\fB\-font\fR \fIFont\fR | \fB\-fn\fR \fIFont\fR" 4 | |
184 | .IX Item "-font Font | -fn Font" | |
185 | Specifies the font to be used for displaying text. | |
186 | .IP "\fB\-foreground\fR \fIColor\fR | \fB\-fg\fR \fIColor\fR" 4 | |
187 | .IX Item "-foreground Color | -fg Color" | |
188 | Specifies the color to be used for text or graphics. | |
189 | .IP "\fB\-geometry\fR \fIGeometry\fR" 4 | |
190 | .IX Item "-geometry Geometry" | |
191 | Specifies the initial size and location of the \fIfirst\fR | |
192 | MainWindow. | |
193 | .IP "\fB\-iconic\fR" 4 | |
194 | .IX Item "-iconic" | |
195 | Indicates that the user would prefer that the application's windows initially | |
196 | not be visible as if the windows had been immediately iconified by the user. | |
197 | Window managers may choose not to honor the application's request. | |
198 | .IP "\fB\-motif\fR" 4 | |
199 | .IX Item "-motif" | |
200 | Specifies that the application should adhere as closely as possible to Motif | |
201 | look-and-feel standards. For example, active elements such as buttons and | |
202 | scrollbar sliders will not change color when the pointer passes over them. | |
203 | .IP "\fB\-name\fR \fIName\fR" 4 | |
204 | .IX Item "-name Name" | |
205 | Specifies the name under which resources for the application should be found. | |
206 | This option is useful in shell aliases to distinguish between invocations | |
207 | of an application, without resorting to creating links to alter the executable | |
208 | file name. | |
209 | .IP "\fB\-synchronous\fR" 4 | |
210 | .IX Item "-synchronous" | |
211 | Indicates that requests to the X server should be sent synchronously, instead of | |
212 | asynchronously. Since Xlib normally buffers requests to the server, errors do | |
213 | do not necessarily get reported immediately after they occur. This option turns | |
214 | off the buffering so that the application can be debugged. It should never | |
215 | be used with a working program. | |
216 | .IP "\fB\-title\fR \fITitleString\fR" 4 | |
217 | .IX Item "-title TitleString" | |
218 | This option specifies the title to be used for this window. This information is | |
219 | sometimes used by a window manager to provide some sort of header identifying | |
220 | the window. | |
221 | .IP "\fB\-xrm\fR \fIResourceString\fR" 4 | |
222 | .IX Item "-xrm ResourceString" | |
223 | Specifies a resource pattern and value to override any defaults. It is also | |
224 | very useful for setting resources that do not have explicit command line | |
225 | arguments. | |
226 | .Sp | |
227 | The \fIResourceString\fR is of the form <\fIpattern\fR>:<\fIvalue\fR>, | |
228 | that is (the first) ':' is used to determine which part is pattern and which | |
229 | part is value. The (<\fIpattern\fR>, <\fIvalue\fR>) pair is entered | |
230 | into the options database with \fBoptionAdd\fR (for each | |
231 | MainWindow configured), with \fIinteractive\fR priority. | |
232 | .Sh "Initial Resources" | |
233 | .IX Subsection "Initial Resources" | |
234 | There are several mechanism for initializing the resource database to be used | |
235 | by an X11 application. Resources may be defined in a $\f(CW\*(C`HOME\*(C'\fR/.Xdefaults file, | |
236 | a system application defaults file (e.g. | |
237 | /usr/lib/X11/app\-defaults/<\fB\s-1CLASS\s0\fR>), | |
238 | or a user application defaults file (e.g. $\f(CW\*(C`HOME\*(C'\fR/<\fB\s-1CLASS\s0\fR>). | |
239 | The Tk::CmdLine functionality for setting initial resources concerns itself | |
240 | with the latter two. | |
241 | .PP | |
242 | Resource files contain data lines of the form | |
243 | <\fIpattern\fR>:<\fIvalue\fR>. | |
244 | They may also contain blank lines and comment lines (denoted | |
245 | by a ! character as the first non-blank character). Refer to option | |
246 | for a description of <\fIpattern\fR>:<\fIvalue\fR>. | |
247 | .IP "System Application Defaults Files" 4 | |
248 | .IX Item "System Application Defaults Files" | |
249 | System application defaults files may be specified via environment variable | |
250 | $\f(CW\*(C`XFILESEARCHPATH\*(C'\fR which, if set, contains a colon-separated list of file | |
251 | patterns. | |
252 | .IP "User Application Defaults Files" 4 | |
253 | .IX Item "User Application Defaults Files" | |
254 | User application defaults files may be specified via environment variables | |
255 | $\f(CW\*(C`XUSERFILESEARCHPATH\*(C'\fR, $\f(CW\*(C`XAPPLRESDIR\*(C'\fR or $\f(CW\*(C`HOME\*(C'\fR. | |
256 | .SH "METHODS" | |
257 | .IX Header "METHODS" | |
258 | .IP "\fBSetArguments\fR" 4 | |
259 | .IX Item "SetArguments" | |
260 | Extract the X11 options contained in a specified array (@ARGV by default). | |
261 | .Sp | |
262 | .Vb 1 | |
263 | \& Tk::CmdLine::SetArguments([@argument]) | |
264 | .Ve | |
265 | .Sp | |
266 | The X11 options may be specified using a single dash \fI\-\fR as per the X11 | |
267 | convention, or using two dashes \fI\-\-\fR as per the \s-1POSIX\s0 standard (e.g. | |
268 | \&\fB\-geometry\fR \fI100x100\fR, \fB\-geometry\fR \fI100x100\fR or \fB\-geometry=\fR\fI100x100\fR). | |
269 | The options may be interspersed with other options or arguments. | |
270 | A \fI\-\-\fR by itself terminates option processing. | |
271 | .Sp | |
272 | By default, command line options are extracted from \f(CW@ARGV\fR the first time | |
273 | a MainWindow is created. The Tk::MainWindow constructor indirectly invokes | |
274 | \&\f(CW\*(C`SetArguments\*(C'\fR to do this. | |
275 | .IP "\fBcget\fR" 4 | |
276 | .IX Item "cget" | |
277 | Get the value of a configuration option specified via \f(CW\*(C`SetArguments\*(C'\fR. | |
278 | (\f(CW\*(C`cget\*(C'\fR first invokes \f(CW\*(C`SetArguments\*(C'\fR if it has not already been invoked.) | |
279 | .Sp | |
280 | .Vb 1 | |
281 | \& Tk::CmdLine::cget([$option]) | |
282 | .Ve | |
283 | .Sp | |
284 | The valid options are: \fB\-class\fR, \fB\-name\fR, \fB\-screen\fR and \fB\-title\fR. | |
285 | If no option is specified, \fB\-class\fR is implied. | |
286 | .Sp | |
287 | A typical use of \f(CW\*(C`cget\*(C'\fR might be to obtain the application class in order | |
288 | to define the name of a resource file to be loaded in via \f(CW\*(C`LoadResources\*(C'\fR. | |
289 | .Sp | |
290 | .Vb 1 | |
291 | \& my $class = Tk::CmdLine::cget(); # process command line and return class | |
292 | .Ve | |
293 | .IP "\fBSetResources\fR" 4 | |
294 | .IX Item "SetResources" | |
295 | Set the initial resources. | |
296 | .Sp | |
297 | .Vb 1 | |
298 | \& Tk::CmdLine::SetResources((\e@resource | $resource) [, $priority]) | |
299 | .Ve | |
300 | .Sp | |
301 | A single resource may be specified using a string of the form | |
302 | \&'<\fIpattern\fR>:<\fIvalue\fR>'. Multiple resources may be specified | |
303 | by passing an array reference whose elements are either strings of the above | |
304 | form, and/or anonymous arrays of the form [ <\fIpattern\fR>, | |
305 | <\fIvalue\fR> ]. The optional second argument specifies the priority, | |
306 | as defined in option, to be associated with the resources | |
307 | (default: \fIuserDefault\fR). | |
308 | .Sp | |
309 | Note that \f(CW\*(C`SetResources\*(C'\fR first invokes \f(CW\*(C`SetArguments\*(C'\fR if it has not already | |
310 | been invoked. | |
311 | .IP "\fBLoadResources\fR" 4 | |
312 | .IX Item "LoadResources" | |
313 | Load initial resources from one or more files. | |
314 | .Sp | |
315 | .Vb 5 | |
316 | \& Tk::CmdLine::LoadResources( | |
317 | \& [ -symbol => $symbol ] | |
318 | \& [ -file => $fileSpec ] | |
319 | \& [ -priority => $priority ] | |
320 | \& [ -echo => $fileHandle ] ); | |
321 | .Ve | |
322 | .Sp | |
323 | [ \fB\-symbol\fR => \f(CW$symbol\fR ] specifies the name of an environment variable | |
324 | that, if set, defines a colon-separated list of one or more directories and/or | |
325 | file patterns. $\f(CW\*(C`XUSERFILESEARCHPATH\*(C'\fR is a special case. | |
326 | If $\f(CW\*(C`XUSERFILESEARCHPATH\*(C'\fR is not set, $\f(CW\*(C`XAPPLRESDIR\*(C'\fR is checked instead. | |
327 | If $\f(CW\*(C`XAPPLRESDIR\*(C'\fR is not set, $\f(CW\*(C`HOME\*(C'\fR is checked instead. | |
328 | .Sp | |
329 | An item is identified as a file pattern if it contains one or more /%[A\-Za\-z]/ | |
330 | patterns. Only patterns \fB%L\fR, \fB%T\fR and \fB%N\fR are currently recognized. All | |
331 | others are replaced with the null string. Pattern \fB%L\fR is translated into | |
332 | $\f(CW\*(C`LANG\*(C'\fR. Pattern \fB%T\fR is translated into \fIapp-defaults\fR. Pattern \fB%N\fR is | |
333 | translated into the application class name. | |
334 | .Sp | |
335 | Each file pattern, after substitutions are applied, is assumed to define a | |
336 | FileSpec to be examined. | |
337 | .Sp | |
338 | When a directory is specified, FileSpecs | |
339 | <\fB\s-1DIRECTORY\s0\fR>/<\fB\s-1LANG\s0\fR>/<\fB\s-1CLASS\s0\fR> | |
340 | and <\fB\s-1DIRECTORY\s0\fR>/<\fB\s-1CLASS\s0\fR> are defined, in that order. | |
341 | .Sp | |
342 | [ \fB\-file\fR => \f(CW$fileSpec\fR ] specifies a resource file to be loaded in. | |
343 | The file is silently skipped if if does not exist, or if it is not readable. | |
344 | .Sp | |
345 | [ \fB\-priority\fR => \f(CW$priority\fR ] specifies the priority, as defined in | |
346 | option, to be associated with the resources | |
347 | (default: \fIuserDefault\fR). | |
348 | .Sp | |
349 | [ \fB\-echo\fR => \f(CW$fileHandle\fR ] may be used to specify that a line should be | |
350 | printed to the corresponding FileHandle (default: \e*STDOUT) everytime a file | |
351 | is examined / loaded. | |
352 | .Sp | |
353 | If no \fB\-symbol\fR or \fB\-file\fR options are specified, \f(CW\*(C`LoadResources\*(C'\fR | |
354 | processes symbol $\f(CW\*(C`XFILESEARCHPATH\*(C'\fR with priority \fIstartupFile\fR and | |
355 | $\f(CW\*(C`XUSERFILESEARCHPATH\*(C'\fR with priority \fIuserDefault\fR. | |
356 | (Note that $\f(CW\*(C`XFILESEARCHPATH\*(C'\fR and $\f(CW\*(C`XUSERFILESEARCHPATH\*(C'\fR are supposed to | |
357 | contain only patterns. $\f(CW\*(C`XAPPLRESDIR\*(C'\fR and $\f(CW\*(C`HOME\*(C'\fR are supposed to be a single | |
358 | directory. \f(CW\*(C`LoadResources\*(C'\fR does not check/care whether this is the case.) | |
359 | .Sp | |
360 | For each set of FileSpecs, \f(CW\*(C`LoadResources\*(C'\fR examines each FileSpec to | |
361 | determine if the file exists and is readable. The first file that meets this | |
362 | criteria is read in and \f(CW\*(C`SetResources\*(C'\fR is invoked. | |
363 | .Sp | |
364 | Note that \f(CW\*(C`LoadResources\*(C'\fR first invokes \f(CW\*(C`SetArguments\*(C'\fR if it has not already | |
365 | been invoked. | |
366 | .SH "NOTES" | |
367 | .IX Header "NOTES" | |
368 | This module is an object-oriented module whose methods can be invoked as object | |
369 | methods, class methods or regular functions. This is accomplished via an | |
370 | internally-maintained object reference which is created as necessary, and which | |
371 | always points to the last object used. \f(CW\*(C`SetArguments\*(C'\fR, \f(CW\*(C`SetResources\*(C'\fR and | |
372 | \&\f(CW\*(C`LoadResources\*(C'\fR return the object reference. | |
373 | .SH "EXAMPLES" | |
374 | .IX Header "EXAMPLES" | |
375 | .IP "1" 4 | |
376 | .IX Item "1" | |
377 | @ARGV is processed by Tk::CmdLine at MainWindow creation. | |
378 | .Sp | |
379 | .Vb 1 | |
380 | \& use Tk; | |
381 | .Ve | |
382 | .Sp | |
383 | .Vb 1 | |
384 | \& # <Process @ARGV - ignoring all X11-specific options> | |
385 | .Ve | |
386 | .Sp | |
387 | .Vb 1 | |
388 | \& my $mw = MainWindow->new(); | |
389 | .Ve | |
390 | .Sp | |
391 | .Vb 1 | |
392 | \& MainLoop(); | |
393 | .Ve | |
394 | .IP "2" 4 | |
395 | .IX Item "2" | |
396 | @ARGV is processed by Tk::CmdLine before MainWindow creation. | |
397 | An \f(CW@ARGV\fR of (\-\-geometry=100x100 \-opt1 a b c \-bg red) | |
398 | is equal to (\-opt1 a b c) after \f(CW\*(C`SetArguments\*(C'\fR is invoked. | |
399 | .Sp | |
400 | .Vb 1 | |
401 | \& use Tk; | |
402 | .Ve | |
403 | .Sp | |
404 | .Vb 1 | |
405 | \& Tk::CmdLine::SetArguments(); # Tk::CmdLine->SetArguments() works too | |
406 | .Ve | |
407 | .Sp | |
408 | .Vb 1 | |
409 | \& # <Process @ARGV - not worrying about X11-specific options> | |
410 | .Ve | |
411 | .Sp | |
412 | .Vb 1 | |
413 | \& my $mw = MainWindow->new(); | |
414 | .Ve | |
415 | .Sp | |
416 | .Vb 1 | |
417 | \& MainLoop(); | |
418 | .Ve | |
419 | .IP "3" 4 | |
420 | .IX Item "3" | |
421 | Just like 2) except that default arguments are loaded first. | |
422 | .Sp | |
423 | .Vb 1 | |
424 | \& use Tk; | |
425 | .Ve | |
426 | .Sp | |
427 | .Vb 2 | |
428 | \& Tk::CmdLine::SetArguments(qw(-name test -iconic)); | |
429 | \& Tk::CmdLine::SetArguments(); | |
430 | .Ve | |
431 | .Sp | |
432 | .Vb 1 | |
433 | \& # <Process @ARGV - not worrying about X11-specific options> | |
434 | .Ve | |
435 | .Sp | |
436 | .Vb 1 | |
437 | \& my $mw = MainWindow->new(); | |
438 | .Ve | |
439 | .Sp | |
440 | .Vb 1 | |
441 | \& MainLoop(); | |
442 | .Ve | |
443 | .IP "4" 4 | |
444 | .IX Item "4" | |
445 | @ARGV is processed by Tk::CmdLine before MainWindow creation. | |
446 | Standard resource files are loaded in before MainWindow creation. | |
447 | .Sp | |
448 | .Vb 1 | |
449 | \& use Tk; | |
450 | .Ve | |
451 | .Sp | |
452 | .Vb 1 | |
453 | \& Tk::CmdLine::SetArguments(); | |
454 | .Ve | |
455 | .Sp | |
456 | .Vb 1 | |
457 | \& # <Process @ARGV - not worrying about X11-specific options> | |
458 | .Ve | |
459 | .Sp | |
460 | .Vb 1 | |
461 | \& Tk::CmdLine::LoadResources(); | |
462 | .Ve | |
463 | .Sp | |
464 | .Vb 1 | |
465 | \& my $mw = MainWindow->new(); | |
466 | .Ve | |
467 | .Sp | |
468 | .Vb 1 | |
469 | \& MainLoop(); | |
470 | .Ve | |
471 | .IP "5" 4 | |
472 | .IX Item "5" | |
473 | @ARGV is processed by Tk::CmdLine before MainWindow creation. | |
474 | Standard resource files are loaded in before MainWindow creation | |
475 | using non-default priorities. | |
476 | .Sp | |
477 | .Vb 1 | |
478 | \& use Tk; | |
479 | .Ve | |
480 | .Sp | |
481 | .Vb 1 | |
482 | \& Tk::CmdLine::SetArguments(); | |
483 | .Ve | |
484 | .Sp | |
485 | .Vb 1 | |
486 | \& # <Process @ARGV - not worrying about X11-specific options> | |
487 | .Ve | |
488 | .Sp | |
489 | .Vb 4 | |
490 | \& Tk::CmdLine::LoadResources(-echo => \e*STDOUT, | |
491 | \& -priority => 65, -symbol => 'XFILESEARCHPATH' ); | |
492 | \& Tk::CmdLine::LoadResources(-echo => \e*STDOUT, | |
493 | \& -priority => 75, -symbol => 'XUSERFILESEARCHPATH' ); | |
494 | .Ve | |
495 | .Sp | |
496 | .Vb 1 | |
497 | \& my $mw = MainWindow->new(); | |
498 | .Ve | |
499 | .Sp | |
500 | .Vb 1 | |
501 | \& MainLoop(); | |
502 | .Ve | |
503 | .IP "6" 4 | |
504 | .IX Item "6" | |
505 | @ARGV is processed by Tk::CmdLine before MainWindow creation. | |
506 | Standard resource files are loaded in before MainWindow creation. | |
507 | Individual resources are also loaded in before MainWindow creation. | |
508 | .Sp | |
509 | .Vb 1 | |
510 | \& use Tk; | |
511 | .Ve | |
512 | .Sp | |
513 | .Vb 1 | |
514 | \& Tk::CmdLine::SetArguments(); | |
515 | .Ve | |
516 | .Sp | |
517 | .Vb 1 | |
518 | \& # <Process @ARGV - not worrying about X11-specific options> | |
519 | .Ve | |
520 | .Sp | |
521 | .Vb 1 | |
522 | \& Tk::CmdLine::LoadResources(); | |
523 | .Ve | |
524 | .Sp | |
525 | .Vb 3 | |
526 | \& Tk::CmdLine::SetResources( # set a single resource | |
527 | \& '*Button*background: red', | |
528 | \& 'widgetDefault' ); | |
529 | .Ve | |
530 | .Sp | |
531 | .Vb 3 | |
532 | \& Tk::CmdLine::SetResources( # set multiple resources | |
533 | \& [ '*Button*background: red', '*Button*foreground: blue' ], | |
534 | \& 'widgetDefault' ); | |
535 | .Ve | |
536 | .Sp | |
537 | .Vb 1 | |
538 | \& my $mw = MainWindow->new(); | |
539 | .Ve | |
540 | .Sp | |
541 | .Vb 1 | |
542 | \& MainLoop(); | |
543 | .Ve | |
544 | .SH "ENVIRONMENT" | |
545 | .IX Header "ENVIRONMENT" | |
546 | .IP "\fB\s-1HOME\s0\fR (optional)" 4 | |
547 | .IX Item "HOME (optional)" | |
548 | Home directory which may contain user application defaults files as | |
549 | $\f(CW\*(C`HOME\*(C'\fR/$\f(CW\*(C`LANG\*(C'\fR/<\fB\s-1CLASS\s0\fR> or $\f(CW\*(C`HOME\*(C'\fR/<\fB\s-1CLASS\s0\fR>. | |
550 | .IP "\fB\s-1LANG\s0\fR (optional)" 4 | |
551 | .IX Item "LANG (optional)" | |
552 | The current language (default: \fIC\fR). | |
553 | .IP "\fB\s-1XFILESEARCHPATH\s0\fR (optional)" 4 | |
554 | .IX Item "XFILESEARCHPATH (optional)" | |
555 | Colon-separated list of FileSpec patterns used in defining | |
556 | system application defaults files. | |
557 | .IP "\fB\s-1XUSERFILESEARCHPATH\s0\fR (optional)" 4 | |
558 | .IX Item "XUSERFILESEARCHPATH (optional)" | |
559 | Colon-separated list of FileSpec patterns used in defining | |
560 | user application defaults files. | |
561 | .IP "\fB\s-1XAPPLRESDIR\s0\fR (optional)" 4 | |
562 | .IX Item "XAPPLRESDIR (optional)" | |
563 | Directory containing user application defaults files as | |
564 | $\f(CW\*(C`XAPPLRESDIR\*(C'\fR/$\f(CW\*(C`LANG\*(C'\fR/<\fB\s-1CLASS\s0\fR> or | |
565 | $\f(CW\*(C`XAPPLRESDIR\*(C'\fR/<\fB\s-1CLASS\s0\fR>. | |
566 | .SH "SEE ALSO" | |
567 | .IX Header "SEE ALSO" | |
568 | MainWindow | |
569 | option | |
570 | .SH "HISTORY" | |
571 | .IX Header "HISTORY" | |
572 | .IP "\(bu" 4 | |
573 | 1999.03.04 Ben Pavon <ben.pavon@hsc.hac.com> | |
574 | .Sp | |
575 | Rewritten as an object-oriented module. | |
576 | .Sp | |
577 | Allow one to process command line options in a specified array (@ARGV by default). | |
578 | Eliminate restrictions on the format and location of the options within the array | |
579 | (previously the X11 options could not be specified in \s-1POSIX\s0 format and had to be | |
580 | at the beginning of the array). | |
581 | .Sp | |
582 | Added the \f(CW\*(C`SetResources\*(C'\fR and \f(CW\*(C`LoadResources\*(C'\fR functions to allow the definition | |
583 | of resources prior to MainWindow creation. |