The dialog
widget class encapsulates a top-level widget
and the widget's interaction with the window manager, Tk's grab mechanism and
the keyboard traversal system. Options normally set through Tk's
wm
command can be specified using widget-configuration options.
Dialog
widgets can be centered relative to the screen or another
top-level widget.
dialog
pathName ?options?
background
Background
-background
#ccc
relief
Relief
-relief
flat
Tk_GetRelief
(3).
borderWidth
BorderWidth
-borderwidth
0
transientFor
TransientFor
-transient
""
grabMode
GrabMode
-grab
none
local
, the dialog box performs a local grab,
affecting only the other windows of the same application. If set to
global
, the dialog box performs a global grab, stopping
mouse and keyboard events from being sent to any other windows in the
display. If set to none
(the default), the dialog box
does not perform any grab.
title
Title
-title
Dialog
x
X
-x
""
y
Y
-y
""
state
State
-state
normal
withdrawn
, the dialog box is removed from
the display. If set to iconic
, the dialog box is iconified.
If set to normal
, the dialog box is displayed normally (ie:
it is mapped if it was previously withdrawn and deiconified if it
was previously iconified).
configure
?options...?
center
?window?
By subclassing from the Dialog class, one can build top-level widgets which
are automatically tied in to the keyboard traversal mechanism provided by
tabgroup
widgets.
By default, dialog
widgets are created with the default
widget class-name "Dialog
". As with Tk's toplevel
widgets, this class name can be overridden by the -class
command-line option. However, when subclassing from the dialog
class, one normally wants the default class-name to be specific to the
new subclass. One could achieve this by calling the dialog constructor with
the -class
option, but this would stop classes further derived
from the subclass from specifying their own class-names. Therefore, the
dialog
class provides the method:
dialog::override_class
class
which will set the class name to a new value unless it has already
been changed by a constructor lower down in the inheritance hierarchy. This
method should be called at the top of the constructor before
calling the constructor of the superclass. For instance:
itcl_class newdialog { inherit dialog ... constructor {config} { set class NewDialog dialog::constructor ... } ... }