pathentry(3)
NAME
Tk::PathEntry - Entry widget for selecting paths with com
pletion
SYNOPSIS
use Tk::PathEntry;
my $pe = $mw->PathEntry(-textvariable => ath)->pack;
$pe->bind("<Return>" => sub { warn "The pathname is
$path0 });
DESCRIPTION
This is an alternative to classic file selection dialogs.
It works more like the file completion in modern shells
like "tcsh" or "bash".
With the "Tab" key, you can force the completion of the
current path. If there are more choices, a window is pop
ping up with these choices. With the "Meta-Backspace" or
"Alt-Backspace" key, the last path component will be
deleted.
OPTIONS
Tk::PathEntry supports all standard Tk::Entry options
except "-vcmd" and "-validate" (these are used internally
in PathEntry). The additional options are:
- -initialdir
- Set the initial path to the value. Alias: "-initial
file". You can also use a pre-filled "-textvariable"
to set the initial path. - -separator
- The character used as the path component separator.
For Unix, this is "/". - -isdircmd
- Can be used to set another directory recognizing sub
routine. The directory name is passed as second param
eter. Alias: "-isdirectorycommand". The default is a
subroutine using "-d". - -choicescmd
- Can be used to set another globbing subroutine. The
current pathname is passed as second parameter. Alias:
"-choicescommand". The default is a subroutine using
the standard "glob" function.
METHODS
- Finish
- This will popdown the window with the completion
choices. It is advisable to bind the Return key to
call this method. The popdown is done automatically
when the widget loses the input focus.
EXAMPLES
- If you want to not require from your users to install
Tk::PathEntry, you can use the following code snippet to
create either a PathEntry or an Entry, depending on what
is installed: - my $e;
if (!eval 'use Tk::PathEntry;
$e = $mw->PathEntry(-textvariable => ile);
$e->bind("<Return>" => sub { $e->Finish });
1; - ') {
$e = $mw->Entry(-textvariable => ile);
- }
$e->pack;
SEE ALSO
Tk::PathEntry::Dialog (3), Tk::Entry (3), tcsh (1), bash
(1).
AUTHOR
Slaven Rezic <srezic@cpan.org>
COPYRIGHT
- Copyright (c) 2001 Slaven Rezic. All rights reserved. This
module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.