A top level window with standard layout.
Synopsis
dialog [-option value...]
Screenshot
Options
- -acceptFocus boolean
- Whether the window should receive the input focus.
- -allowGrow
-
type: boolean
-
Whether the window may be greater than its children require.
-
-allowShrink
-
type: boolean
-
Whether the window can be made smaller than the place that its
children require.
-
-buttons
-
type: list (default: %#Ok)
-
List of buttons to be displayed. An element of the list can be
either the name of a stock button ("%#Cancel"), pure text,
a list of a button ID created via the gnocl::button command and a
value which shall be returned if this button is selected, or a list
of text (either pure text or a PERCENTSTRING) and a stock icon
("%#Ok"), in which case the value of the stock icon is
returned, if the button is selected.
-
-child
-
type: widget-ID
-
The widget to be shown. This option or -text is required.
-
-defaultButton
-
type: integer
-
Selects the default button which can normally be chosen by simply
pressing return. The last button is selected per default (see HIG).
-
-defaultHeight
-
type: integer
-
Default height of the window.
-
-defaultWidth
-
type: integer
-
Default width of the window.
-
-dragTargets
-
type: list of strings
-
List of source targets (e.g. text/plain or application/x-color)
which are supported.
-
-dropTargets
-
type: list of strings
-
List of destination targets (e.g. text/plain or application/x-color)
which are supported.
-
-icon
-
type: percent-string
(default: "")
-
Sets the icon of the dialog which is shown, depending on the
windowmanager, in the window decoration, the window list, and/or if
the window is iconified. This must be either a file name (prefix
"%/") or empty.
-
-modal
-
type: boolean (default: 1)
-
Whether the window is modal, i.e. it grabs all GTK+ events.
-
-name
-
type: string
-
Name of the widget, can be used to set options in an rc file.
-
-onDelete
-
type: string (default: "")
-
Tcl command which is executed if the widget shall be deleted. If the
command returns 0, the widget is not deleted. Before evaluation the
following percent strings are substituted:
%w widget
name -
-onDestroy
-
type: string (default: "")
-
Tcl command which is executed if the widget is destroyed. Before
evaluation the following percent strings are substituted:
%w widget name -
-onDragData
-
type: string (default: "")
-
Tcl command which is executed if data is draged from this the widget
to another. This command must return the data to be draged. Before
evaluation the following percent strings are substituted:
%w widget name %t time %T type of data -
-onDropData
-
type: string (default: "")
-
Tcl command which is executed if data is dropped on the widget.
Before evaluation the following percent strings are substituted:
%w widget name %d data %l length of data %t time %T type of data %x x coordinate %y y coordinate
-
-onKeyPress
-
type: string (default: "")
-
Tcl command which is executed if a key is pressed while the widget
is having the focus. Before evaluation the following percent strings
are substituted:
%w widget name %k key code as
integer %K key code as symbol %a unicode unicode character, or
the empty string if there is no corresponding character %s state
of the buttons and modifiers (bitmask)
-
-onKeyRelease
-
type: string (default: "")
-
Tcl command which is executed if a key is released while the widget
is having the focus. Before evaluation the following percent strings
are substituted:
%w widget name %k key code as
integer %K key code as symbol %a unicode character, or
the empty string if there is no corresponding character %s state
of the buttons and modifiers (bitmask)
-
-onPopupMenu
-
type: string (default: "")
-
Tcl command which is executed if the "popup-menu" signal
is received, which is normally the case if the user presses
Shift-F10. Before evaluation the following percent strings are substituted:
%w widget name -
-onRealize
-
type: string (default: "")
-
Tcl command which is executed in the global scope if the widget has
been realized. Before evaluation the following percent strings are substituted:
%w widget name -
-onResponse
-
type: string (default: "break")
-
Tcl command which is executed if a button is chosen. If the command
returns the return code TCL_BREAK, as it is the default, the dialogue
is closed. onResponse returns TCL_BREAK if either the last command
of onResponse is "break", or the tcl procedure which is
called as last command in onResponse exits with "return -code
break". Before evaluation the following percent strings are
substituted:
%v text of the button chosen, or "#NONE"
or "#DELETE"
-
-onShowHelp
-
type: string (default: "")
-
Tcl command which is executed in the global scope if the "show-help"
signal is received, which is normally the case if the user presses
F1 or Ctrl-F1. Before evaluation the following percent strings are substituted:
%w widget name %h help type: either
"whatsThis" or "tooltip" -
-resizable
-
type: boolean (default: 1)
-
Whether the user can change the size of the window.
-
-text
-
type: string
-
The text to be shown. This option or -child is required.
-
-title
-
type: string (default: "")
-
Title of the dialog.
-
-tooltip
-
type: string
-
Message that appear next to this widget when the mouse pointer is
held over it for a short amount of time.
-
-type
-
type: ONE OF info, warning, question or error
-
Type of the dialogue. This determines the icon which is displayed. If
the option -text is given, the default is info, if option -child is
given, the default is to display no icon.
Description
A gnocl::dialog widget is a top level window with an icon, (which option -child is
given, this is optional) some text or other widgets as content and
one or more buttons. It could be created with the Gnocl low level
commands, but a gnocl::dialog makes it very simple to inform the user with a
standardized interface. If the gnocl::dialog is modal, which is the default, the
gnocl::dialog command does not return a window ID. Instead it returns the
text of the button chosen, or "#DELETE" if the window is
deleted, for example by clicking the close button in the window
frame. If the gnocl::dialog is not modal, a window ID is returned as in all
other Gnocl widget commands, and the button chosen can be determined
by the callback function onResponse.
Commands
- id delete
-
Deletes the widget and the associated tcl command.
Example
proc responseProc { val } {
if { "Yes" == $val } {
return -code break
} else {
gnocl::dialog \
-type question \
-text "Are you sure?" \
-buttons %#No
}
}
gnocl::dialog \
-type question \
-text "Do you like Gnocl?" \
-buttons "%#No {{%_I _like it} %#Yes}" \
-onResponse "responseProc %v"
results in
|
|