1chooseDirectory(3)    User Contributed Perl Documentation   chooseDirectory(3)
2
3
4

NAME

6       chooseDirectory - pops up a dialog box for the user to select a direc‐
7       tory.
8

SYNOPSIS

10       $widget->chooseDirectory( ?option value ...? );
11

DESCRIPTION

13       The method chooseDirectory is implemented as a perl wrapper on the core
14       tk "command" tk_chooseDirectory, and $widget is passed as the argument
15       to the hidden -parent option.
16
17       The chooseDirectory method pops up a dialog box for the user to select
18       a directory. The following option-value pairs are possible as command
19       line arguments:
20
21       -initialdir dirname
22           Specifies that the directories in directory should be displayed
23           when the dialog pops up. If this parameter is not specified, then
24           the directories in the current working directory are displayed. If
25           the parameter specifies a relative path, the return value will con‐
26           vert the relative path to an absolute path.  This option may not
27           always work on the Macintosh.  This is not a bug. Rather, the Gen‐
28           eral Controls control panel on the Mac allows the end user to over‐
29           ride the application default directory.
30
31       -parent $widget
32           Makes $widget the logical parent of the dialog. The dialog is dis‐
33           played on top of its parent window.
34
35       -title titleString
36           Specifies a string to display as the title of the dialog box. If
37           this option is not specified, then a default title will be dis‐
38           played.
39
40       -mustexist boolean
41           Specifies whether the user may specify non-existant directories.
42           If this parameter is true, then the user may only select directo‐
43           ries that already exist.  The default value is false.
44

CAVEATS

46       Perl does not have a concept of encoded filesystems yet. This means
47       that operations on filenames like "opendir" and "open" still use byte
48       semantics. Tk however uses character semantics internally, which means
49       that you can get filenames with the UTF-8 flag set in functions like
50       "chooseDirectory", "getOpenFile" and similar. It's the user's responsi‐
51       bility to determine the encoding of the underlying filesystem and con‐
52       vert the result into bytes, e.g.
53
54           use Encode;
55           ...
56           my $dir = $mw->chooseDirectory;
57           $dir = encode("windows-1252", $dir);
58           opendir DIR, $dir or die $!;
59           ...
60
61       See also "When Unicode Does Not Happen" in perlunicode and "Unicode in
62       Filenames" in perltodo.
63

SEE ALSO

65       Tk::getOpenFile, Tk::getOpenFile
66

KEYWORDS

68       directory selection dialog
69
70
71
72perl v5.8.8                       2008-02-05                chooseDirectory(3)
Impressum