Home --- Description --- Create --- Install --- Download for Perl/Tk Version 804.028 on Linux
This change affects the getOpenFile and getSaveFile methods of the Perl/Tk toolkit on Linux, which are used to pop up a dialog box to select a file to open or save, respectively the underlying FBox.pm module.
The enhanced FBox.pm module provides a new property named showhidden that enables or disables the listing of hidden items by setting it's value to 'on' or 'off':
$File = $w->getOpenFile(-title => "Sample Window", -showhidden => 'off');
If the showhidden property is omitted, the FBox.pm works in the usual way, which means, that you can still use all your programs as they are, after you installed the enhanced FBox.pm module.



The enhanced FBox.pm module provides a new property named msgfont that you can use to set the font for feedbacks, just like this:
$File = $w->getSaveFile(-title => "Sample Window", -msgfont => '{My FontName} 10 bold');
If the msgfont property is omitted, feedback works with no font specified (i.e. the message shows up with 'some' font), which means, that you can still use all your programs as they are, after you installed the enhanced FBox.pm module.



$w->ConfigSpecs(-defaultextension => ['PASSIVE', undef, undef, undef],
-filetypes => ['PASSIVE', undef, undef, undef],
-initialdir => ['PASSIVE', undef, undef, undef],
-initialfile => ['PASSIVE', undef, undef, undef],
# -sortcmd => ['PASSIVE', undef, undef, sub { lc($a) cmp lc($b) }],
-sortcmd => ['PASSIVE', undef, undef, sub { lc($_[0]) cmp lc($_[1]) }],
-title => ['PASSIVE', undef, undef, undef],
-type => ['PASSIVE', undef, undef, 'open'],
-filter => ['PASSIVE', undef, undef, '*'],
-force => ['PASSIVE', undef, undef, 0],
-multiple => ['PASSIVE', undef, undef, 0],
-msgfont => ['PASSIVE', undef, undef, 0],
-showhidden => ['PASSIVE', undef, undef, 0],
'DEFAULT' => [$icons],
);
my $reply = $w->messageBox
(-icon => 'warning',
-font => $msgfont,
-type => 'YesNo',
-message => "File \"$selectFilePath\" already exists.\nDo you want to overwrite it?");
return unless (lc($reply) eq 'yes');
sub Done {
my $w = shift;
my $msgfont = $w->cget(-msgfont);
.
.
.
# Make the dir & file list within the sub Update and there first create a local variable for the showhidden property and then add the evaluation code as shown in the following code snippet: # Make the dir & file list
my $cwd = _cwd();
my $showhidden = $w->cget(-showhidden);
local *FDIR;
if (opendir(FDIR, $cwd)) {
my @files;
my $sortcmd = sub { $w->cget(-sortcmd)->($a,$b) };
my $flt = $w->cget(-filter);
my $fltcb;
if (ref $flt eq 'CODE') {
$fltcb = $flt;
} else {
$flt = _rx_to_glob($flt);
}
my $type_dir = $w->cget(-type) eq 'dir';
foreach my $f (sort $sortcmd readdir(FDIR)) {
next if $f eq '.' or $f eq '..';
#
# Evaluate showhidden property:
if ($showhidden eq 'off'){
next if substr($f, 0, 1) eq '.';
}
.
.
.
WARNING:
While this file replacement may work in a similar way on other platforms too, you could encounter trouble with the implementation. While the code for the msgfont property will run as is, the one for the showhidden property is os-dependent (For Windows the use of an additional module is needed). Moreover on Windows 2000 and ActiveState Perl v5.8.8, Perl/Tk version 804.027 for example, you can run a program with a changed FBox.pm module as long, as you use legacy calls with getOpenFile resp. getSaveFile. If you incorporate the new properties in the method call you'll end up with a 'bad option' error. There seems to be a controlling mechanism concerning the options which I didn't yet understand, maybe the option database is the right suspect... Unfortunately this is a rather tricky thing, and since I am barely using Windows this will take it's time...
Home --- Description --- Create --- Install --- Download for Perl/Tk Version 804.028 on Linux