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

NAME

Tk::XDialogBox - create and manipulate a dialog screen with added Features.

SYNOPSIS

    use Tk::DialogBox
    ...
    $d = $top->DialogBox(
        -title => "Title", 
        -buttons => ["OK", "Cancel"],
        -check_callback => sub {
                my $answer = shift;
                if ( $answer eq 'OK') {
                        error('Col1 must be a number!');
                        return undef;
                } 
                return 1;
          },
        );
    $w = $d->add(Widget, args);
    $d->Focus(Widget); # set new Focus on a Widget    
    $button = $d->Show;

DESCRIPTION

DialogBox is very similar to Dialog except that it allows any widget in the top frame. DialogBox creates two frames---"top" and "bottom". The bottom frame shows all the specified buttons, lined up from left to right. The top frame acts as a container for all other widgets that can be added with the add() method. The non-standard options recognized by DialogBox are as follows:

PATCHES

- Show - new Option 'nograb'

- check_callback new Option check_callback, return true and Window is close

- Focus($widget), set Focus on Widget

- width and height for resize the dialogbox

- from_x and from_y for coordinates to open the dialog box

OPTIONS

-title

Specify the title of the dialog box. If this is not set, then the name of the program is used.

-buttons

The buttons to display in the bottom frame. This is a reference to an array of strings containing the text to put on each button. There is no default value for this. If you do not specify any buttons, no buttons will be displayed.

-default_button

Specifies the default button that is considered invoked when user presses <Return> on the dialog box. This button is highlighted. If no default button is specified, then the first element of the array whose reference is passed to the -buttons option is used as the default.

-check_callback

Option check_callback, this will run the subroutine when submit ever button. The callback have one Parameter, the buttontext. If the return undef, then the dialogbox will not close.

  -check_callback => sub {
        my $answer = shift;
        if ( $answer eq 'Save') {
                error('Col1 must be a number!');
                return undef;
        } 
        return 1;
  },
-width

Width in pixel.

-heigth

Heigth in pixel.

-from_x

Specifies the Coordinates to place the dialogbox in the screen. It is default 50.

-from_y

Specifies the Coordinates to place the dialogbox in the screen. It is default 50.

METHODS

DialogBox supports only two methods as of now:

add(widget, options)

Add the widget indicated by widget. Widget can be the name of any Tk widget (standard or contributed). Options are the options that the widget accepts. The widget is advertized as a subwidget of DialogBox.

Show(grab or -nograb)

Display the dialog box, until user invokes one of the buttons in the bottom frame. If the grab type is specified in grab, then Show uses that grab; otherwise it uses a local grab. With -nograb switch off the grabbing Returns the name of the button invoked.

Focus(widget)

Set the focus on the widget and not on the defaultbutton.

BINDINGS

Escape

close the Dialogbox

Return and KP_Enter

Submit the first Button

<Control-Return> and <Control-KP_Enter>

Submit the first Button

BUGS

There is no way of removing a widget once it has been added to the top frame.

There is no control over the appearance of the buttons in the bottom frame nor is there any way to control the placement of the two frames with respect to each other e.g. widgets to the left, buttons to the right instead of widgets on the top and buttons on the bottom always.

AUTHOR

Rajappa Iyer rsi@earthling.net

This code is distributed under the same terms as Perl.

Patched and additional features by Frank (xpix) Herrmann

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 305:

'=item' outside of any '=over'

Around line 318:

You forgot a '=back' before '=head1'