The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tk::HdrResizeButton - provides a resizeable button for a HList column header.

SYNOPSIS

    use Tk;
    use Tk::HList;
    use Tk::HdrResizeButton;

    my $mw = MainWindow->new();

    # CREATE MY HLIST
    my $hlist = $mw->Scrolled('HList',
         -columns=>2, 
         -header => 1
         )->pack(-side => 'left', -expand => 'yes', -fill => 'both');

    # CREATE COLUMN HEADER 0
    my $headerstyle   = $hlist->ItemStyle('window', -padx => 0, -pady => 0);
    my $header0 = $hlist->HdrResizeButton( 
          -text => 'Test Name', 
          -relief => 'flat', -pady => 0, 
          -command => sub { print "Hello, world!\n";}, 
          -column => 0
    );
    $hlist->header('create', 0, 
          -itemtype => 'window',
          -widget => $header0, 
          -style=>$headerstyle
    );

    # CREATE COLUMN HEADER 1
    my $header1 = $hlist->HdrResizeButton( 
          -text => 'Status', 
          -command => sub { print "Hello, world!\n";}, 
          -column => 1
    );
    $hlist->header('create', 1,
          -itemtype => 'window',
          -widget   => $header1, 
          -style    => $headerstyle
    );

DESCRIPTION

The HdrResizeButton widget provides a resizeable button widget for use in an HList column header. When placed in the column header, the right edge of the widget can be selected and dragged to a new location to change the size of the HList column. When resizing the column, a column bar will also be placed over the HList indicating the eventual size of the HList column. A command can also be bound to the button to do things like sorting the column. On DoubleClicking a Column it is closed / re-opened. A Right-ButtonClick will resize the column to the fit the needs of all the column contents.

The widget takes all the options that a standard Button does. Note: For a proper operationthe following option MUST be specified during creation:

-column

The column number that this HdrResizeButton is associated with. (It has to be provided to resize the appropriate column).

In addition, the following options may be specified:

-command

The default command is associated with an open/close function for the selected column. The function is called with a Tk::HdrResizeButton reference for custom usage.

-activebackground

The background color used for the column Header during active state (Mouse over Header).

-activeforeground

The foreground color used for the column Header during active state (Mouse over Header).

-buttondownrelief

The relief used for the column Header Button during selected state (Button pressed).

-minwidth

The minwidth is used for the specific column (during resize), default: 30.

-closedminwidth

The closedminwidth is used for the specific column (while in "CLOSED" view), default: 10.

-resizerwidth

The resizerwidth is the resize sensor-area on the right border of the specific column, default: 1.

AUTHOR

Shaun Wandler <wandler@unixmail.compaq.com>

UPDATES

Updated by Slaven Rezic and Frank Herrmann, Enhanced/Modified by Michael Krause KrauseM_AT_gmx_DOT_net

DONE (MK) position columnbar correctly and only use MoveColumnBar to move it instead of destroying it and re-creating with CreateColumnBar
(???) use Subwidget('scrolled') if it exists
DONE (MK) don't give error if -command is not specified
DONE (MK) don't let the user hide columns (minwidth?)
DONE (MK) * double-click on column should not more execute the single-click command callback

KEYWORDS

Tk::HList