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 "GETOPENFILE 1" | |
132 | .TH GETOPENFILE 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | getOpenFile, getSaveFile \- pop up a dialog box for the user to select a file to open or save. | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | \&\ \fI$widget\fR\->\fBgetOpenFile\fR(?\fI\-option\fR=>value, ...>?) | |
138 | .PP | |
139 | \&\ \fI$widget\fR\->\fBgetSaveFile\fR(?\fI\-option\fR=>value, ...>?) | |
140 | .SH "DESCRIPTION" | |
141 | .IX Header "DESCRIPTION" | |
142 | The methods \fBgetOpenFile\fR and \fBgetSaveFile\fR pop up a | |
143 | dialog box for the user to select a file to open or save. | |
144 | .PP | |
145 | The \fBgetOpenFile\fR method is usually associated with the \fBOpen\fR | |
146 | command in the \fBFile\fR menu. Its purpose is for the user to select an | |
147 | existing file \fIonly\fR. If the user enters an non-existent file, the | |
148 | dialog box gives the user an error prompt and requires the user to give | |
149 | an alternative selection. If an application allows the user to create | |
150 | new files, it should do so by providing a separate \fBNew\fR menu command. | |
151 | .PP | |
152 | The \fBgetSaveFile\fR method is usually associated with the \fBSave\fR | |
153 | as command in the \fBFile\fR menu. If the user enters a file that | |
154 | already exists, the dialog box prompts the user for confirmation | |
155 | whether the existing file should be overwritten or not. | |
156 | .PP | |
157 | If the user selects a file, both \fBgetOpenFile\fR and | |
158 | \&\fBgetSaveFile\fR return the full pathname of this file. If the | |
159 | user cancels the operation, both commands return an undefined value. | |
160 | .PP | |
161 | The following \fIoption-value\fR pairs are possible as command line | |
162 | arguments to these two commands: | |
163 | .IP "\fB\-defaultextension\fR => \fIextension\fR" 4 | |
164 | .IX Item "-defaultextension => extension" | |
165 | Specifies a string that will be appended to the filename if the user | |
166 | enters a filename without an extension. The default value is the empty | |
167 | string, which means no extension will be appended to the filename in | |
168 | any case. This option is ignored on the Macintosh platform, which | |
169 | does not require extensions to filenames. | |
170 | .IP "\fB\-filetypes\fR => [\fIfilePattern\fR ?, ...?]" 4 | |
171 | .IX Item "-filetypes => [filePattern ?, ...?]" | |
172 | If a \fBFile types\fR listbox exists in the file dialog on the particular | |
173 | platform, this option gives the \fIfiletype\fRs in this listbox. When | |
174 | the user choose a filetype in the listbox, only the files of that type | |
175 | are listed. If this option is unspecified, or if it is set to the | |
176 | empty list, or if the \fBFile types\fR listbox is not supported by the | |
177 | particular platform then all files are listed regardless of their | |
178 | types. See \*(L"\s-1SPECIFYING\s0 \s-1FILE\s0 \s-1PATTERNS\s0\*(R" below for a | |
179 | discussion on the contents of \fIfilePattern\fRs. | |
180 | .IP "\fB\-initialdir\fR => \fIdirectory\fR" 4 | |
181 | .IX Item "-initialdir => directory" | |
182 | Specifies that the files in \fIdirectory\fR should be displayed | |
183 | when the dialog pops up. If this parameter is not specified, then | |
184 | the files in the current working directory are displayed. This | |
185 | option may not always work on the Macintosh. This is not a bug. | |
186 | Rather, the \fIGeneral Controls\fR control panel on the Mac allows the | |
187 | end user to override the application default directory. | |
188 | .IP "\fB\-initialfile\fR => \fIfilename\fR" 4 | |
189 | .IX Item "-initialfile => filename" | |
190 | Specifies a filename to be displayed in the dialog when it pops | |
191 | up. This option is ignored by the \fBgetOpenFile\fR method. | |
192 | .IP "\fB\-title\fR => \fItitleString\fR" 4 | |
193 | .IX Item "-title => titleString" | |
194 | Specifies a string to display as the title of the dialog box. If this | |
195 | option is not specified, then a default title is displayed. This | |
196 | option is ignored on the Macintosh platform. | |
197 | .SH "SPECIFYING FILE PATTERNS" | |
198 | .IX Header "SPECIFYING FILE PATTERNS" | |
199 | The \fIfilePattern\fRs given by the \fB\-filetypes\fR option | |
200 | are a list of file patterns. Each file pattern is a list of the | |
201 | form | |
202 | .PP | |
203 | .Vb 1 | |
204 | \& typeName [extension ?extension ...?] ?[macType ?macType ...?]? | |
205 | .Ve | |
206 | .PP | |
207 | \&\fItypeName\fR is the name of the file type described by this | |
208 | file pattern and is the text string that appears in the \fBFile types\fR | |
209 | listbox. \fIextension\fR is a file extension for this file pattern. | |
210 | \&\fImacType\fR is a four-character Macintosh file type. The list of | |
211 | \&\fImacType\fRs is optional and may be omitted for applications that do | |
212 | not need to execute on the Macintosh platform. | |
213 | .PP | |
214 | Several file patterns may have the same \fItypeName,\fR in which case | |
215 | they refer to the same file type and share the same entry in the | |
216 | listbox. When the user selects an entry in the listbox, all the files | |
217 | that match at least one of the file patterns corresponding | |
218 | to that entry are listed. Usually, each file pattern corresponds to a | |
219 | distinct type of file. The use of more than one file patterns for one | |
220 | type of file is necessary on the Macintosh platform only. | |
221 | .PP | |
222 | On the Macintosh platform, a file matches a file pattern if its | |
223 | name matches at least one of the \fIextension\fR(s) \s-1AND\s0 it | |
224 | belongs to at least one of the \fImacType\fR(s) of the | |
225 | file pattern. For example, the \fBC Source Files\fR file pattern in the | |
226 | sample code matches with files that have a \fB\e.c\fR extension \s-1AND\s0 | |
227 | belong to the \fImacType\fR \fB\s-1TEXT\s0\fR. To use the \s-1OR\s0 rule instead, | |
228 | you can use two file patterns, one with the \fIextensions\fR only and | |
229 | the other with the \fImacType\fR only. The \fB\s-1GIF\s0 Files\fR file type | |
230 | in the sample code matches files that \s-1EITHER\s0 have a \fB\e.gif\fR | |
231 | extension \s-1OR\s0 belong to the \fImacType\fR \fB\s-1GIFF\s0\fR. | |
232 | .PP | |
233 | On the Unix and Windows platforms, a file matches a file pattern | |
234 | if its name matches at at least one of the \fIextension\fR(s) of | |
235 | the file pattern. The \fImacType\fRs are ignored. | |
236 | .SH "SPECIFYING EXTENSIONS" | |
237 | .IX Header "SPECIFYING EXTENSIONS" | |
238 | On the Unix and Macintosh platforms, extensions are matched using | |
239 | glob-style pattern matching. On the Windows platforms, extensions are | |
240 | matched by the underlying operating system. The types of possible | |
241 | extensions are: (1) the special extension * matches any | |
242 | file; (2) the special extension "" matches any files that | |
243 | do not have an extension (i.e., the filename contains no full stop | |
244 | character); (3) any character string that does not contain any wild | |
245 | card characters (* and ?). | |
246 | .PP | |
247 | Due to the different pattern matching rules on the various platforms, | |
248 | to ensure portability, wild card characters are not allowed in the | |
249 | extensions, except as in the special extension *. Extensions | |
250 | without a full stop character (e.g, ~) are allowed but may not | |
251 | work on all platforms. | |
252 | .SH "EXAMPLE" | |
253 | .IX Header "EXAMPLE" | |
254 | .Vb 9 | |
255 | \& my $types = [ | |
256 | \& ['Text Files', ['.txt', '.text']], | |
257 | \& ['TCL Scripts', '.tcl' ], | |
258 | \& ['C Source Files', '.c', 'TEXT'], | |
259 | \& ['GIF Files', '.gif', ], | |
260 | \& ['GIF Files', '', 'GIFF'], | |
261 | \& ['All Files', '*', ], | |
262 | \& ]; | |
263 | \& my $filename = $widget->getOpenFile(-filetypes=>$types); | |
264 | .Ve | |
265 | .PP | |
266 | .Vb 3 | |
267 | \& if ($filename ne "") { | |
268 | \& # Open the file ... | |
269 | \& } | |
270 | .Ve | |
271 | .SH "SEE ALSO" | |
272 | .IX Header "SEE ALSO" | |
273 | Tk::FBox, Tk::FileSelect | |
274 | .SH "KEYWORDS" | |
275 | .IX Header "KEYWORDS" | |
276 | file selection dialog |