Gtk2::PathButtonBar - Creates a bar for path manipulation.
Version 0.1.2
This creates a collection of buttons and a entry widget to help with browsing a path or etc.
It is composed of two lines. The first line contains a set of buttons. The first button is a button that blanks the current path. This is the 'goRoot' button and displays what ever the user has decided the root is by setting the 'root' key when invoking the new funtions. The buttons after that are ones that correspond to a chunk of the path, broken up by what ever the delimiter is set to. When any of these are pressed, the entry text is changed as well to relfect it. The 'goRoot' button clears the path to ''.
The second line starts with a label. The label is the same as on the 'goRoot' button and is what ever the root is set as. After that there is a single line text entry widget. This allows the path to be set by typing it in. After the text entry widget, there is a button labeled 'Go'. When this button is pressed, it updates the button bar with what is in text entry widget.
Any time the path is updated, '$self->{exec}' is ran through eval.
use Gtk2; use Gtk2::PathButtonBar; Gtk2->init; my $window = Gtk2::Window->new(); my $pbb=Gtk2::PathButtonBar->new({exec=>'print "path=".${$myself}->{path}."\na=".${$myself}->{vars}{a}."\n";', vars=>{a=>1}, }); print $pbb->{vbox}."\n"; $window->add($pbb->{vbox}); $window->show;
This initiates this widget. This takes it's arguements in the form of a hash. The accepted keys can be found below.
This is what will be considered a delimiter between directories or whatever. The default is '/'.
This is a string that will be executed any time any change is done. Change the text in the string entry box does not constitute a change till the 'Go' button is pressed.
For example, setting it to the following, would cause it to print the current path followed a new line and then a 'a=' what ever '$self->{vars}{a}' is set to.
exec=>'print "path=".${$myself}->{path}."\na=".${$myself}->{vars}{a}."\n:;
If you wish to pass any sort of variables to this, it is strongly suggested you do it by using the 'vars' key in the hash passed to the new function.
Upon a failure to execute the code in exec, it will issue a warning.
This is what will be displayed as being the root. This wills how up in the 'goRoot' button and in the label before the entry box.
If it is not defined, it defaults to what ever the delimiter is. If the delimiter is not set, that means this will display '/', which works nicely for most unix FS stuff.
This is the path that the it will originally be set to.
This is meant to contain variables that will be used with '$self->{exec}'.
This is called when a new path is set by pressing the go button.
There is no reason to ever call this from '$self->{exec}'.
This is called when a new path is set by pressing the root button.
If you wish to call this from '$self->{exec}', do it as below.
${$myself}->goRoot;
This is a internal function that rebuilds the button bar.
${$myself}->makeButtons;
This changes the current path.
One arguement is accepted and that is the path.
$pbb->setPath($somepath); if($self->{error}){ print "Error!\n"; }
This blanks the error storage and is only meant for internal usage.
It does the following.
$self->{error}=undef; $self->{errorString}="";
No path specified.
Zane C. Bowers, <vvelox at vvelox.net>
<vvelox at vvelox.net>
Please report any bugs or feature requests to bug-gtk2-pathbuttonbar at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Gtk2-PathButtonBar. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-gtk2-pathbuttonbar at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Gtk2::PathButtonBar
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Gtk2-PathButtonBar
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Gtk2-PathButtonBar
CPAN Ratings
http://cpanratings.perl.org/d/Gtk2-PathButtonBar
Search CPAN
http://search.cpan.org/dist/Gtk2-PathButtonBar
Copyright 2008 Zane C. Bowers, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Gtk2::PathButtonBar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::PathButtonBar
CPAN shell
perl -MCPAN -e shell install Gtk2::PathButtonBar
For more information on module installation, please visit the detailed CPAN module installation guide.