1DirTree(3) User Contributed Perl Documentation DirTree(3)
2
3
4
6 Tk::DirTree - Create and manipulate DirTree widgets
7
9 use Tk::DirTree;
10
11 $dirtree = $parent->DirTree(?options?);
12
14 The DirTree class is derived from the Tree class and inherits all the
15 methods, options and subwidgets of its super-class.
16
18 Tree supports all the standard options of a Tree widget. See
19 Tk::options for details on the standard options.
20
22 Name: browseCmd
23 Class: BrowseCmd
24 Switch: -browsecmd
25 Specifies a callback to call whenever the user browses on a
26 directory (usually by single-clicking on the name of the
27 directory). The callback is called with one argument, the complete
28 pathname of the directory.
29
30 Name: command
31 Class: Command
32 Switch: -command
33 Specifies the callback to be called when the user activates on a
34 directory (usually by double-clicking on the name of the
35 directory). The callback is called with one argument, the complete
36 pathname of the directory.
37
38 Name: dircmd
39 Class: DirCmd
40 Switch: -dircmd
41 Specifies the callback to be called when a directory listing is
42 needed for a particular directory. If this option is not specified,
43 by default the DirTree widget will attempt to read the directory as
44 a Unix directory. On special occasions, the application programmer
45 may want to supply a special method for reading directories: for
46 example, when he needs to list remote directories. In this case,
47 the -dircmd option can be used. The specified callback accepts two
48 arguments: the first is the name of the directory to be listed; the
49 second is a Boolean value indicating whether hidden sub-directories
50 should be listed. This callback returns a list of names of the sub-
51 directories of this directory. For example:
52
53 sub read_dir {
54 my( $dir, $showhidden ) = @_;
55 return( qw/DOS NORTON WINDOWS/ ) if $dir eq "C:\\";
56 return();
57 }
58
59 Name: showHidden
60 Class: ShowHidden
61 Switch: -showhidden
62 Specifies whether hidden directories should be shown. By default, a
63 directory name starting with a period "." is considered as a hidden
64 directory. This rule can be overridden by supplying an alternative
65 -dircmd option.
66
67 Name: directory
68 Class: Directory
69 Switch: -directory
70 Alias: -value
71 Specifies the name of the current directory to be displayed in the
72 DirTree widget.
73
75 The DirTree constructor method creates a new window (given by the
76 $dirtree argument) and makes it into a DirTree widget. Additional
77 options, described above, may be specified on the command line or in
78 the option database to configure aspects of the DirTree such as its
79 cursor and relief. The DirTree widget displays a list view of a
80 directory, its previous directories and its sub-directories. The user
81 can choose one of the directories displayed in the list or change to
82 another directory.
83
85 The DirTree method creates a widget object. This object supports the
86 configure and cget methods described in Tk::options which can be used
87 to enquire and modify the options described above. The widget also
88 inherits all the methods provided by the generic Tk::Widget class.
89
90 The following additional methods are available for DirTree widgets:
91
92 $dirtree->chdir(dir)
93 Change the current directory to dir.
94
96 These methods have to be documented or made private:
97
98 OpenCmd
99 Populate
100 add_to_tree
101 dirnames
102 fullpath
103 has_subdir
104 opencmd
105 set_dir
106
108 The mouse and keyboard bindings of the DirTree widget are the same as
109 the bindings of the Tree widget.
110
112 directory, tree, tix
113
115 Tk::Tree Tk::HList
116
118 Perl/TK version by Chris Dean <ctdean@cogit.com>. Original Tcl/Tix
119 version by Ioi Kim Lam.
120
121
122
123perl v5.32.0 2020-07-28 DirTree(3)