Last Review: Nov-27-2010

Home  ---   Description  ---   Create  ---   Install



Description of the enhanced FBox.pm module

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 the following 'new' features:

Property showhidden

FBox.pm's default behaviour is to include hidden files and directories into it's listings. This can cause a lot of scrolling work, especially when running under Linux, since the Linux home directory contains a whole bunch of such items. These items appear in front of the list, so one always has to 'wipe' them aside, if the desired items are not hidden ones.

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.



Perl/Tk FBox.pm on Linux with hidden items

Perl/Tk FBox.pm filled with hidden items (some 50 items in front of the other ones)


Perl/Tk FBox.pm on Linux without hidden items

Perl/Tk FBox.pm without hidden items


Property msgfont

It always disturbed me, that the methods Feedback Dialog Boxes did'nt show up with nice fonts, moreover they delivered (on my system) kind of ugly, behemot letters:

Perl/Tk FBox.pm with legacy feedback dialog

Perl/Tk FBox.pm with legacy feedback dialog

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.



Now lets have a look at some sample output of the enhanced FBox.pm module:

Perl/Tk FBox.pm with enhanced feedback dialog, 1st sample

Perl/Tk FBox.pm with enhanced feedback dialog, 1st sample

Perl/Tk FBox.pm with enhanced feedback dialog, 2nd sample

Perl/Tk FBox.pm with enhanced feedback dialog, 2nd sample

Perl/Tk FBox.pm with enhanced feedback dialog, 3rd sample

Perl/Tk FBox.pm with enhanced feedback dialog, 3rd sample


HINT:
On Linux you can get even nicer font rendering when building your Perl/Tk with the XFT=1 flag (Requires Perl/Tk-804.029, libxft2-dev and libxrender-dev packages and the command perl Makefile.PL XFT=1 instead of perl Makefile.PL to install):

Perl/Tk FBox.pm with enhanced feedback dialog, 4th sample

Perl/Tk FBox.pm with enhanced feedback dialog, 4th sample


Enhanced File Name Entry

While typing into the file name entry of FBox.pm has always served the awaited results, it did not reflect a mouse pointer made file choice within the file name entry. This looked like that:

Perl/Tk FBox.pm with selected file and default behaviour

Perl/Tk FBox.pm file selection with default appearance


With the enhanced version these selections now appear in the file name entry. Thus they can be utilised for example, when it is used for a Save As dialog. With a click on a file name that is similar to the desired name the file name entry will be provided with an editable template.



Perl/Tk FBox.pm with selected file and enhanced behaviour

Perl/Tk FBox.pm file selection with enhanced appearance (selection inserted into entry)

Perl/Tk FBox.pm with selected file and enhanced behaviour

Perl/Tk FBox.pm file selection with enhanced appearance (selection after edit)

Important:
To use the file name entry value, you have to hit the <ENTER> key, do not click a mouse button respectively don't click the Button on the right side which replaces the (edited) entry with the original List Box Selection.



Create the enhanced FBox.pm module

Folling this guide you can change your existing FBox.pm module in about fifteen minutes (see the Install Section for the modules directory on Linux machines) into the enhanced FBox.pm module.



Install the enhanced FBox.pm module

This way creating the enhanced FBox.pm module was tested on a Linux Box with Perl 5.8.8 and Perl/Tk Version 804.028 respectively Perl 5.10.1 and Perl/Tk Version 804.029. Depending on your system FBox.pm may reside in a place like this:

/usr/local/lib/perl/5.8.8/Tk/ or /usr/local/lib/perl/5.10.0/Tk/ resp. /usr/local/lib/perl/5.10.1/Tk/

Change your working directory to the above one and then first make a backup of your old FBox.pm module. Now replace it with the enhanced FBox.pm module. Take care of proper naming and permissions for the file (You do these operations as root).

You can test this installation by opening a file in your (Linux) home directory resp. trying to overwrite an existing filename with the accordingly parameterized getOpenFile resp. getSaveFile methods in one of your programs.

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 not using Windows...

HINT:
While Linux systems usually supply a (rich) Perl environment, Windows users may want to have a look at one of the following Perl flavours:

Home  ---   Description  ---   Create  ---   Install



Copyright © by Andreas-Josef v. Gencsy 2008-2010

AjvG is programmer of
vGShop - Copyright (c) 1999-2008 by A.-J. v. Gencsy
vGShop the managed Online Shop System