1Prima::Dialog::FileDialUosge(r3)Contributed Perl DocumenPtraitmiao:n:Dialog::FileDialog(3)
2
3
4
6 Prima::Dialog::FileDialog - File system related widgets and dialogs.
7
9 # open a file use Prima qw(Application Dialog::FileDialog);
10
11 my $open = Prima::Dialog::OpenDialog-> new(
12 filter => [
13 ['Perl modules' => '*.pm'],
14 ['All' => '*']
15 ]
16 );
17 print $open-> fileName, " is to be opened\n" if $open-> execute;
18
19 # save a file
20 my $save = Prima::Dialog::SaveDialog-> new(
21 fileName => $open-> fileName,
22 );
23 print $save-> fileName, " is to be saved\n" if $save-> execute;
24
25 # open several files
26 $open-> multiSelect(1);
27 print $open-> fileName, " are to be opened\n" if $open-> execute;
28
30 The module contains widgets for file and drive selection, and also
31 standard open file, save file, and change directory dialogs.
32
34 A directory listing list box. Shows the list of subdirectories and
35 upper directories, hierarchy-mapped, with the folder images and
36 outlines.
37
38 Properties
39 closedGlyphs INTEGER
40 Number of horizontal equal-width images, contained in closedIcon
41 property.
42
43 Default value: 1
44
45 closedIcon ICON
46 Provides an icon representation for the directories, contained in
47 the current directory.
48
49 indent INTEGER
50 A positive integer number of pixels, used for offset of the
51 hierarchy outline.
52
53 Default value: 12
54
55 openedGlyphs INTEGER
56 Number of horizontal equal-width images, contained in openedIcon
57 property.
58
59 Default value: 1
60
61 openedIcon OBJECT
62 Provides an icon representation for the directories, contained in
63 the directories above the current directory.
64
65 path STRING
66 Runtime-only property. Selects a file system path.
67
68 showDotDirs BOOLEAN
69 Selects if the directories with the first dot character are shown
70 the view. The treatment of the dot-prefixed names as hidden is
71 traditional to unix, and is of doubtful use under win32.
72
73 Default value: 1
74
75 Methods
76 files [ FILE_TYPE ]
77 If FILE_TYPE value is not specified, the list of all files in the
78 current directory is returned. If FILE_TYPE is given, only the
79 files of the types are returned. The FILE_TYPE is a string, one of
80 those returned by "Prima::Utils::getdir" ( see "getdir" in
81 Prima::Utils.
82
84 Provides drive selection combo-box for non-unix systems.
85
86 Properties
87 firstDrive DRIVE_LETTER
88 Create-only property.
89
90 Default value: 'A:'
91
92 DRIVE_LETTER can be set to other value to start the drive
93 enumeration from. Some OSes can probe eventual diskette drives
94 inside the drive enumeration routines, so it might be reasonable to
95 set DRIVE_LETTER to "C:" string for responsiveness increase.
96
97 drive DRIVE_LETTER
98 Selects the drive letter.
99
100 Default value: 'C:'
101
103 Provides a standard file dialog, allowing to navigate by the file
104 system and select one or many files. The class can operate in two modes
105 - 'open' and 'save'; these modes are set by Prima::Dialog::OpenDialog
106 and Prima::Dialog::SaveDialog. Some properties behave differently
107 depending on the mode, which is stored in openMode property.
108
109 Properties
110 createPrompt BOOLEAN
111 If 1, and a file selected is nonexistent, asks the user if the file
112 is to be created.
113
114 Only actual when openMode is 1.
115
116 Default value: 0
117
118 defaultExt STRING
119 Selects the file extension, appended to the file name typed by the
120 user, if the extension is not given.
121
122 Default value: ''
123
124 directory STRING
125 Selects the currently selected directory.
126
127 fileMustExist BOOLEAN
128 If 1, ensures that the file typed by the user exists before closing
129 the dialog.
130
131 Default value: 1
132
133 fileName STRING, ...
134 For single-file selection, assigns the selected file name, For
135 multiple-file selection, on get-call returns list of the selected
136 files; on set-call, accepts a single string, where the file names
137 are separated by the space character. The eventual space characters
138 must be quoted.
139
140 filter ARRAY
141 Contains array of arrays of string pairs, where each pair describes
142 a file type. The first scalar in the pair is the description of the
143 type; the second is a file mask.
144
145 Default value: [[ 'All files' => '*']]
146
147 filterIndex INTEGER
148 Selects the index in filter array of the currently selected file
149 type.
150
151 multiSelect BOOLEAN
152 Selects whether the user can select several ( 1 ) or one ( 0 )
153 file.
154
155 See also: fileName.
156
157 noReadOnly BOOLEAN
158 If 1, fails to open a file when it is read-only.
159
160 Default value: 0
161
162 Only actual when openMode is 0.
163
164 noTestFileCreate BOOLEAN
165 If 0, tests if a file selected can be created.
166
167 Default value: 0
168
169 Only actual when openMode is 0.
170
171 overwritePrompt BOOLEAN
172 If 1, asks the user if the file selected is to be overwrittten.
173
174 Default value: 1
175
176 Only actual when openMode is 0.
177
178 openMode BOOLEAN
179 Create-only property.
180
181 Selects whether the dialog operates in 'open' ( 1 ) mode or 'save'
182 ( 0 ) mode.
183
184 pathMustExist BOOLEAN
185 If 1, ensures that the path, types by the user, exists before
186 closing the dialog.
187
188 Default value: 1
189
190 showDotFiles BOOLEAN
191 Selects if the directories with the first dot character are shown
192 the files view.
193
194 Default value: 0
195
196 showHelp BOOLEAN
197 Create-only property. If 1, 'Help' button is inserted in the
198 dialog.
199
200 Default value: 1
201
202 sorted BOOLEAN
203 Selects whether the file list appears sorted by name ( 1 ) or not (
204 0 ).
205
206 Default value : 1
207
208 system BOOLEAN
209 Create-only property. If set to 1, "Prima::Dialog::FileDialog"
210 returns instance of "Prima::sys::XXX::FileDialog" system-specific
211 file dialog, if available for the XXX platform.
212
213 "system" knows only how to map "FileDialog", "OpenDialog", and
214 "SaveDialog" classes onto the system-specific file dialog classes;
215 the inherited classes are not affected.
216
217 Methods
218 reread
219 Re-reads the currently selected directory.
220
222 Descendant of Prima::Dialog::FileDialog, tuned for open-dialog
223 functionality.
224
226 Descendant of Prima::Dialog::FileDialog, tuned for save-dialog
227 functionality.
228
230 Provides standard dialog with interactive directory selection.
231
232 Properties
233 directory STRING
234 Selects the directory
235
236 showDotDirs
237 Selects if the directories with the first dot character are shown
238 the view.
239
240 Default value: 0
241
242 showHelp
243 Create-only property. If 1, 'Help' button is inserted in the
244 dialog.
245
246 Default value: 1
247
249 Dmitry Karasik, <dmitry@karasik.eu.org>.
250
252 Prima, Prima::Window, Prima::Lists, examples/drivecombo.pl,
253 examples/launch.pl.
254
255
256
257perl v5.34.0 2021-07-22 Prima::Dialog::FileDialog(3)