Linux Blog

Xdialog

Section: X11/tool (1)
Updated: 2.3.1
Index Return to Main Contents
 

NAME

Xdialog - (c)dialog replacement for X-Windows  

SYNTAX

Xdialog [<common options>] [<transient options>] <box option> ...

and:

Xdialog <special option>  

DESCRIPTION

Xdialog is designed to be a drop in replacement for the dialog and cdialog programs (BTW Xdialog may also be used in place of gdialog). It converts any terminal based program into a program with an X-windows interface. The dialogs are easier to see and use, and the new widgets adds even more functionality.

To achieve this, Xdialog uses the Gimp ToolKit (also known as GTK+).  

OPTIONS

The [<common options>] [<transient options>] <box option> sequence may be repeated several times in the same Xdialog command line (this is called dialog chaining). The common/transient options may be omitted but there must always be a box option as the last Xdialog option.

Common options:

The <common options> are options applying to all following <box options> until the same or opposite <common options> are encountered into the Xdialog command line. These options are mostly dealing with menu look, style, placement and behaviour.

Available common options:

--wmclass <name>
--rc-file <gtkrc filename>
--backtitle <backtitle>
--title <title>
--allow-close | --no-close
--screen-center | --under-mouse | --auto-placement
--center | --right | --left | --fill
--no-wrap | --wrap
--cr-wrap | --no-cr-wrap
--stderr | --stdout
--separator <character> | --separate-output
--buttons-style default|icon|text

Transient options:

The <transient options> only apply to the next <box option> into the Xdialog command line. These options are used to tune the widgets (number and type of buttons, menu icon) or to trigger some of the widgets specific features.

Available transient options:

--fixed-font
This option is for use with --tailbox, --textbox and --editbox.
--password | --password=1|2
This option may be repeated 2 or 3 times before --2inputsbox or --3inputsbox. It is also possible to specify one (and only one) password field with the --password=1|2 syntax.
--editable
This option is for use with --combobox.
--time-stamp | --date-stamp
This option is for use with --logbox.
--reverse
This option is for use with --logbox.
--keep-colors
This option is for use with --logbox.
--interval <timeout>
This option may be used with input(s) boxes, combo box, range(s) boxes, spin(s) boxes, list boxes, menu box, treeview, calendar and timebox widgets.
--timeout <timeout> (in seconds)
This option may be used with all but infobox, gauge and progress widgets.
--no-tags
This option is for use with --menubox, --checklist and --radiolist.
--item-help
When this option is used, the <helpN> parameters of the --menubox, --checklist, --radiolist, --buildlist and --treeview options must be specified (while they must be omitted if --item-help is not specified).
--default-item <tag>
This option is for use with --menubox.
--icon <xpm filename>
This option is for use with any widget accepting a <text> parameter.
--no-ok
This option is for use with --tailbox and --logbox.
--no-cancel
This option may be used with all but --infobox, --gauge and --progress.
--no-buttons
This option may be used with --textbox, --tailbox, --logbox, --infobox, --fselect and --dselect.
--default-no
This option may be used with all widgets with a "Cancel" or "No" button. Note that it is ignored when the --wizard option is in force.
--wizard
This option may be used with all but --msgbox, --infobox, --gauge and --progress.
--help <help>
This option may be used with all but --infobox, --gauge and --progress.
--print <printer>
This option is for use with --tailbox, --textbox and --editbox.
--check <label> [<status>]
This option may be used with all but --infobox, --gauge and --progress.
--ok-label <label>
This option may be used with all widgets with a "OK" or "Yes" button. Note that it is ignored when the --wizard option is in force.
--cancel-label <label>
This option may be used with all widgets with a "Cancel" or "No" button. Note that it is ignored when the --wizard option is in force.
--beep
This option may be used with all widgets.
--beep-after
This option may be used with all widgets.
--begin <Yorg> <Xorg>
This option may be used with all widgets.
--ignore-eof
This option may be used with --infobox and --gauge.
--smooth
This option is for use with --tailbox and --logbox.
Box options:

The <box option> tells to Xdialog which widget must be used and is followed by three or more parameters:

the first parameter is a text string or a filename (this depends on the box option);
the second and the third parameters are menu <height> and <width> in characters. These two parameters may be replaced by a single <XSIZExYSIZE> parameter, giving the width and height in pixels. When a size of 0 0 (or 0x0) is passed to Xdialog, then the widget is auto-sized by GTK+. When a size of -1 -1 (or -1x-1) is passed, then the Xdialog widget is set to the maximum size so to fit the screen. It is possible to give the widget an absolute origin on the screen (provided your window manager lets you do so), either by using the --begin transient option (when the size is given in characters) or by using a "-geometry"-like origin (e.g. 400x200+20-30).
some box options require additional parameters such as tags, menu items, labels or default values.

Available box options:

--yesno         <text> <height> <width>
--msgbox               <text> <height> <width>
--infobox              <text> <height> <width> [<timeout>]
--gauge                <text> <height> <width> [<percent>]
--progress     <text> <height> <width> [<maxdots> [[-]<msglen>]]
--inputbox     <text> <height> <width> [<init>]
--2inputsbox   <text> <height> <width> <label1> <init1> <label2> <init2>
--3inputsbox   <text> <height> <width> <label1> <init1> <label2> <init2> <label3> <init3>
--combobox     <text> <height> <width> <item1> ... <itemN>
--rangebox     <text> <height> <width> <min value> <max value> [<default value>]
--2rangesbox   <text> <height> <width> <label1> <min1> <max1> <def1> <label2> <min2> <max2> <def2>
--3rangesbox   <text> <height> <width> <label1> <min1> <max1> <def1> <label2> <min2> <max2> <def2> <label3> <min3> <max3> <def3>
--spinbox              <text> <height> <width> <min> <max> <def> <label>
--2spinsbox    <text> <height> <width> <min1> <max1> <def1> <label1> <min2> <max2> <def2> <label2>
--3spinsbox    <text> <height> <width> <min1> <max1> <def1> <label1> <min2> <max2> <def2> <label2> <min3> <max3> <def3> <label3>
--textbox              <file> <height> <width>
--editbox              <file> <height> <width>
--tailbox              <file> <height> <width>
--logbox               <file> <height> <width>
--menubox              <text> <height> <width> <menu height> <tag1> <item1> {<help1>}...
--checklist    <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--radiolist    <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--buildlist    <text> <height> <width> <list height> <tag1> <item1> <status1> {<help1>}...
--treeview     <text> <height> <width> <list height> <tag1> <item1> <status1> <item_depth1> {<help1>}...
--fselect              <file> <height> <width>
--dselect              <directory> <height> <width>
--colorsel     <text> <height> <width> [<red> <green> <blue>]
--fontsel              <font name> <height> <width>
--calendar     <text> <height> <width> [<day> <month> <year>]
--timebox              <text> <height> <width> [<hours> <minutes> <seconds>]

Special options:

The <special options> take no parameter and are to be used alone into the command line. They just make Xdialog to print a string on stderr and to exit immediately (with a 0 exit code).

Available special options:

--version                       (prints version number to stderr and exits).
--print-version        (same as above in a cdialog-compatible way).
--print-maxsize        (prints maximum menu size in characters and exits).
 

DIAGNOSTICS

On completion of each box option (i.e. every time a widget is closed) Xdialog sends any result (text, numbers) as one or more strings to stderr (this can be changed so that the results are sent to stdout thanks to a common option).

When Xdialog terminates (i.e. when all the <box options> are processed or when an error occurs), the exit code may take the following values:

0 : OK, Yes or Next button pressed.
1 : Cancel or No button pressed.
2 : Help button pressed (when the --help transient option was passed an empty string).
3 : Previous button pressed (--wizard transient option in force).
255 : an error (or timeout) occurred, or the box was closed through the window manager (same exit code as when the ESC key is pressed in (c)dialog).

Note that when chaining dialogs, the chain is broken and Xdialog terminates as soon as a widget returns a non zero exit code.  

FILES

/usr/bin/Xdialog
/usr/share/locale/*/LC_MESSAGES/Xdialog.mo
/usr/man/man1/Xdialog.1*
/usr/share/doc/Xdialog-2.3.1/*
/usr/share/doc/Xdialog-2.3.1/samples/*  

ENVIRONMENT VARIABLES

XDIALOG_HIGH_DIALOG_COMPAT

When set to 1 or true (case insensitive), this environment variable turns the (c)dialog high compatibility mode on. The net effect is that:
- a fixed (monospacing) font is used in all Xdialog widgets (including labels, tags, menu/list items and buttons);
- the --left common option is used as the default justification option instead of the --center one;
- the <text> wrapping is always in force (--wrap) and the --fill option is ignored.
- the --no-cr-wrap common option is used as the default instead of the --cr-wrap one (but it does not apply to the <backtitle> in this case).
- regardless of the specified box size, the auto-sizing feature of Xdialog is forced when XDIALOG_FORCE_AUTOSIZE environment variable is set it to 1 or true. This makes for the sizing problems of some menus (e.g. when the specified box size is actually too small for the number of specified menu/list entries to fit).
- the Cancel button is not displayed into the tailbox and textbox widgets;
- the infobox widget is turned into a msgbox unless the XDIALOG_INFOBOX_TIMEOUT environment variable is set (in 1/1000s) and greater than 0, in which case an actual infobox without button is used;
- the --version special option returns the same string as --print-version.

XDIALOG_FORCE_AUTOSIZE
XDIALOG_INFOBOX_TIMEOUT

See the notes about XDIALOG_HIGH_DIALOG_COMPAT above.

XDIALOG_NO_GMSGS

Setting this variable to 1 will prevent the Gdk, GLib and Gtk library from emitting messages via g_log().
 

EXAMPLES

Sample scripts are available in the /usr/share/doc/Xdialog-2.3.1/samples/ directory.
Full HTML doc with screen shots, examples and FAQ is available in the /usr/share/doc/Xdialog-2.3.1/ directory.  

AUTHORS

Thierry Godefroy <xdialog@free.fr> (from v1.1.0 onwards)
Alfred Reynolds <alfred@cyberone.com.au> (v1.0 only)  

SEE ALSO

dialog(1), cdialog(1)


 

Index

NAME
SYNTAX
DESCRIPTION
OPTIONS
DIAGNOSTICS
FILES
ENVIRONMENT VARIABLES
EXAMPLES
AUTHORS
SEE ALSO

Linux Blog

»

examples of using Xdialog



Graphical Shell Scripting