Create and manipulate filebrowser dialogs
Curses::UI::Widget | +----Curses::UI::Container | +----Curses::UI::Window | +----Curses::UI::Dialog::Filebrowser
use Curses::UI; my $cui = new Curses::UI; my $win = $cui->add('window_id', 'Window');
# The hard way. # ------------- my $dialog = $win->add( 'mydialog', 'Dialog::Filebrowser' ); $dialog->focus; my $file = $dialog->get(); $win->delete('mydialog');
# The easy way (see Curses::UI documentation). # -------------------------------------------- $file = $cui->filebrowser(); $file = $cui->loadfilebrowser(); $file = $cui->savefilebrowser();
Curses::UI::Dialog::Filebrowser is a filebrowser dialog. This type of dialog can be used to select a file, anywhere on the filesystem.
See exampes/demo-Curses::UI::Dialog::Filebrowser in the distribution for a short demo.
-title < \s-1TEXT\s0 > Set the title of the dialog window to \s-1TEXT\s0.
-path < \s-1PATH\s0 > Set the path to start with to \s-1PATH\s0. If this path does not exist, the filebrowser will start in the rootdirectory.
-file < \s-1FILE\s0 > Set the filename to start with to \s-1FILE\s0.
-editfilename < \s-1BOOLEAN\s0 > If \s-1BOOLEAN\s0 has a true value, the user may edit the filename. This is for example useful for a filebrowser that is used to select a filename to save to. By default this option is set to false.
-show_hidden < \s-1BOOLEAN\s0 > If \s-1BOOLEAN\s0 has a true value, hidden files (the filename starts with a dot) will also be shown. By default this option is set to false.
-mask < \s-1ARRAYREF\s0 > If -mask is defined, a filemask popupbox will be added to the filebrowser dialog window. This popupbox will filter the list of files that is displayed, using a regular expression (case insensitive). The \s-1ARRAYREF\s0 contains a list of array references. Each array reference has two elements: a regexp and a description. Here's an example -mask: my $mask = [ [ '.', 'All files (*)' ], [ '\.txt$', 'Text files (*.txt)' ] [ 'howto', 'HOWTO documentation' ], [ 'core', 'Core files' ], ];
-mask_selected < \s-1INDEX\s0 > Normally the first mask in the list of masks will be made active upon creation of the filebrowser. If you want another mask to be active, use the -mask_selected option. Set this value to the index of the mask you want to be active. For example: if you would want the \*(L"howto\*(R" mask in the above example to be active, you would use the value 2 for -mask_selected.
new ( \s-1OPTIONS\s0 )
layout ( )
draw ( \s-1BOOLEAN\s0 )
focus ( ) These are standard methods. See Curses::UI::Container for an explanation of these.
get ( ) This method will return the complete path to the file that was selected using the filebrowser. If no file was selected, this method will return an undefined value.
escape This will invoke the cancel button, so the filebrowser widget returns without selecting any file.
~ If the directory- or filelistbox of the dialog window has the focus and the tilde (~) button is pressed, the filebrowser will chdir to the homedirectory of the current user.
Curses::UI, Curses::UI::Container, Curses::UI::Buttonbox
Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.
Maintained by Marcus Thiesen ([email protected])
This package is free software and is provided \*(L"as is\*(R" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.