Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  TK::DIALOGBOX (3)

.ds Aq ’


Tk::DialogBox - create and manipulate a dialog screen.



    use Tk::DialogBox
    $d = $top->DialogBox(-title => "Title", -buttons => ["OK", "Cancel"]);
    $w = $d->add(Widget, args)->pack;
    $button = $d->Show;


<B>DialogBoxB> is very similar to <B>DialogB> except that it allows any widget in the top Frame. <B>DialogBoxB> 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 <B>B>add()<B>B> method.


The options recognized by <B>DialogBoxB> are as follows:
<B>-titleB> Specify the title of the DialogBox. If this is not set, then the name of the program is used.
<B>-buttonsB> The button names 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 button names, no Buttons are displayed.
<B>-default_buttonB> Specifies the default Button that is considered invoked when user presses <Return> on the DialogBox. This Button is highlighted. If no default Button is specified, then the first element of the array whose reference is passed to the <B>-buttonsB> option is used as the default.
<B>-cancel_buttonB> Specifies the Button that is considered invoked when the user closes the DialogBox using the window manager’s close button. If the <B>-cancel_buttonB> option is not given, and if there’s only one button configured, then this button is also used as the cancel button. Otherwise no button is considered as the cancel button; in such a case <B>ShowB> just returns undef when the user closes the DialogBox.
<B>-commandB> A callback which is executed after invoking an action to close the DialogBox, but before restoring focus and grab information. The selected button is passed as the first argument.
<B>-focusB> Specify the widget to receive the initial focus after popping up the DialogBox. By default the <B>-default_buttonB> widget receives the initial focus.
<B>-showcommandB> A callback which is executed before displaying the DialogBox and waiting for user input. The DialogBox itself is passed as the first argument.


<B>DialogBoxB> supports only two methods as of now:
<B>add(B>widget, options<B>)B> 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 <B>DialogBoxB>. The name of widget is lower-cased and used as the advertised name. If multiple instances of widget are created in the <B>DialogBoxB>, then only the last one gets the advertised name. <B>B>add()<B>B> does not automatically <B>B>pack()<B>B> or <B>B>grid()<B>B> widget into the <B>DialogBoxB>.
<B>Show(B>?-global?<B>)B> Displays the Dialog until the user invokes one of the Buttons in the bottom Frame. If the grab type -global is specified, then <B>ShowB> uses that grab; otherwise it defaults to a local grab. Returns the name of the Button invoked.

The actual Dialog is shown using the <B>PopupB> method. Any other options supplied to <B>ShowB> are passed to <B>PopupB>, and can be used to position the Dialog on the screen. Please read Tk::Popup for details.

<B>B>Exit()<B>B> Close the dialogbox, by emulating a click on the default button.


<B>topB> The subwidget reference to the top half of the DialogBox widget, the Frame containing widgets added by the <B>addB> method.
<B>bottomB> The subwidget reference to the bottom half of the DialogBox widget, the Frame containing the Button widgets.
<B>B_‘‘button-text’’B> Individual subwidget references to the Buttons in the DialogBox widget. The subwidget name is the string B_ concatenated with the Button’s -text value.


There is no way of removing a widget once it has been added to the top Frame, unless you access the top subwidget and go through the child widgets.

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.


Rajappa Iyer

This code is distributed under the same terms as Perl.

Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 DIALOGBOX (3) 2013-11-15

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.