Zane C. Bowers-Hadley > Gtk2-PathButtonBar > Gtk2::PathButtonBar



Annotate this POD (1)

View/Report Bugs
Module Version: 0.1.2   Source  


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;
    my $window = Gtk2::Window->new();
    my $pbb=Gtk2::PathButtonBar->new({exec=>'print "path=".${$myself}->{path}."\na=".${$myself}->{vars}{a}."\n";',
    print $pbb->{vbox}."\n";



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.



This is a internal function that rebuilds the button bar.

If you wish to call this from '$self->{exec}', do it as below.



This changes the current path.

One arguement is accepted and that is the path.

        print "Error!\n";


This blanks the error storage and is only meant for internal usage.

It does the following.




No path specified.


Zane C. Bowers, <vvelox at>


Please report any bugs or feature requests to bug-gtk2-pathbuttonbar at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Gtk2::PathButtonBar

You can also look for information at:



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.

syntax highlighting: