1tk_chooseDirectory(n)        Tk Built-In Commands        tk_chooseDirectory(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       tk_chooseDirectory  -  pops  up  a  dialog box for the user to select a
9       directory.
10

SYNOPSIS

12       tk_chooseDirectory ?option value ...?
13______________________________________________________________________________
14

DESCRIPTION

16       The procedure tk_chooseDirectory pops up a dialog box for the  user  to
17       select  a  directory.  The following option-value pairs are possible as
18       command line arguments:
19
20       -command string
21              Specifies the prefix of a Tcl command to invoke  when  the  user
22              closes  the  dialog after having selected an item. This callback
23              is not called if the user cancelled the dialog. The actual  com‐
24              mand  consists  of  string  followed  by  a  space and the value
25              selected by the user in the dialog. This is  only  available  on
26              Mac OS X.
27
28       -initialdir dirname
29              Specifies  that the directories in directory should be displayed
30              when the dialog pops up. If this parameter is not specified, the
31              initial  directory  defaults to the current working directory on
32              non-Windows systems and on Windows systems prior to  Vista.   On
33              Vista  and  later systems, the initial directory defaults to the
34              last user-selected directory for the application. If the parame‐
35              ter specifies a relative path, the return value will convert the
36              relative path to an absolute path.
37
38       -message string
39              Specifies a message to include in the client area of the dialog.
40              This is only available on Mac OS X.
41
42       -mustexist boolean
43              Specifies whether the user may specify non-existent directories.
44              If this parameter is true, then the user may only select  direc‐
45              tories that already exist.  The default value is false.
46
47       -parent window
48              Makes  window  the  logical  parent of the dialog. The dialog is
49              displayed on top of its parent window. On Mac OS X,  this  turns
50              the file dialog into a sheet attached to the parent window.
51
52       -title titleString
53              Specifies a string to display as the title of the dialog box. If
54              this option is not specified, then a default title will be  dis‐
55              played.
56

EXAMPLE

58              set dir [tk_chooseDirectory \
59                      -initialdir ~ -title "Choose a directory"]
60              if {$dir eq ""} {
61                 label .l -text "No directory selected"
62              } else {
63                 label .l -text "Selected $dir"
64              }
65

SEE ALSO

67       tk_getOpenFile(n), tk_getSaveFile(n)
68

KEYWORDS

70       directory, selection, dialog, platform-specific
71
72
73
74Tk                                    8.3                tk_chooseDirectory(n)
Impressum