# xmessage - display a message or query in a window (X-based /bin/e... - man(1) - [phpMan]

[_XMESSAGE_(1)](https://www.chedong.com/phpMan.php/man/XMESSAGE/1/markdown)                            General Commands Manual                           [_XMESSAGE_(1)](https://www.chedong.com/phpMan.php/man/XMESSAGE/1/markdown)

## NAME
       xmessage - display a message or query in a window (X-based /bin/echo)

## SYNOPSIS
       **xmessage **[ **-buttons _**label1_[**:_**value1_]**,_**label2_[**:_**value2_]**, **...  ] [ _options_ ] **-file _**filename_
       **xmessage **[ **-buttons _**label1_[**:_**value1_]**,_**label2_[**:_**value2_]**, **...  ] [ _options_ ] _message_ ...

## DESCRIPTION
       The _xmessage_ program displays a window containing a message from the command line, a file, or
       standard  input.   Along  the  lower edge of the message is row of buttons; clicking the left
       mouse button on any of these buttons will cause _xmessage_ to exit.  Which button  was  pressed
       is  returned  in the exit status and, optionally, by writing the label of the button to stan‐
       dard output.

       The program is typically used by shell scripts to display information to the user or  to  ask
       the user to make a choice.

       Unless  a  size is specified, _xmessage_ sizes itself to fit the message, up to a maximum size.
       If the message is too big for the window, _xmessage_ will display scroll bars.

## OPTIONS
       These are the command line options that _xmessage_ understands, in  addition  to  the  standard
       ones listed in [**X**(7)](https://www.chedong.com/phpMan.php/man/X/7/markdown).

### -buttons _
               This  option will cause _xmessage_ to create one button for each comma-separated _button_
               argument.  The corresponding resource is **buttons**.  Each _button_ consists  of  a  label
               optionally  followed by a colon and an exit value.  The label is the name of the Com‐
               mand button widget created and will be the default text displayed to the user.  Since
               this is the name of the widget it may be used to change any of the resources  associ‐
               ated with that button.  The exit value will be returned by _xmessage_ if that button is
               selected.   The  default  exit value is 100 plus the button number.  Buttons are num‐
               bered from the left starting with one.  The default string if no **-buttons  **option  is
               given is **okay:0**.

### -default _
               Defines  the  button with a matching _label_ to be the default.  If not specified there
               is no default.  The corresponding resource is **defaultButton**.   Pressing  Return  any‐
               where  in  the  _xmessage_ window will activate the default button.  The default button
               has a wider border than the others.

### -file _
               File to display.  The corresponding resource is **file**.  A _filename_ of `**-**'  reads  from
               standard input.  If this option is not supplied, _xmessage_ will display all non-option
               arguments in the style of _echo_.  Either **-file **or a message on the command line should
               be provided, but not both.

### -print  
               put.   Equivalent to setting the **printValue **resource to TRUE.  This is one way to get
               feedback as to which button was pressed.

### -center 
               source to TRUE.

### -nearmouse
               Pop  up  the  window  near the mouse cursor.  Equivalent to setting the **nearMouse **re‐
               source to TRUE.

### -timeout _
               Exit with status 0 after _secs_ seconds if the user has not clicked on  a  button  yet.
               The corresponding resource is **timeout**.

## WIDGET HIERARCHY
       Knowing  the  name and position in the hierarchy of each widget is useful when specifying re‐
       sources for them.  In the following chart, the class and name of each widget is given.

       Xmessage (xmessage)
            Form form
                 Text message
                 Command (label1)
                 Command (label2)
                 .
                 .
                 .

## RESOURCES
       The program has a few top-level application resources that allow customizations that are spe‐
       cific to _xmessage_.

       **file    **A String specifying the file to display.

       **buttons **A String specifying the buttons to display.  See the **-buttons **command-line option.

### defaultButton
               A String specifying a default button by label.

### printValue
               A Boolean value specifying whether the label of the button pressed to exit  the  pro‐
               gram is written to standard output.  The default is FALSE.

       **center  **A  Boolean value specifying whether to pop up the window at the center of the screen.
               The default is FALSE.

### nearMouse
               A Boolean value specifying whether to pop up the window near the mouse  cursor.   The
               default is FALSE.

       **timeout **The  number  of  seconds  after which to exit with status 0.  The default is 0, which
               means never time out.

       **maxHeight (**class **Maximum)**
               The maximum height of the text part of the window in pixels,  used  if  no  size  was
               specified  in  the  geometry.  The default is 0, which means use 70% of the height of
               the screen.

       **maxWidth (**class **Maximum)**
               The maximum width of the text part of the window in pixels, used if no size was spec‐
               ified in the geometry.  The default is 0, which means use 70% of  the  width  of  the
               screen.

## ACTIONS
       **exit(_**value_**)**
               exit  immediately  with an exit status of _value_ (default 0).  This action can be used
               with translations to provide alternate ways of exiting _xmessage_.

### default-exit()
               exit immediately with the exit status specified by the default button.  If  there  is
               no default button, this action has no effect.

## EXIT STATUS
       If it detects an error, _xmessage_ returns 1, so this value should not be used with a button.

## SEE ALSO
       [_X_(7)](https://www.chedong.com/phpMan.php/man/X/7/markdown), [_echo_(1)](https://www.chedong.com/phpMan.php/man/echo/1/markdown), [_cat_(1)](https://www.chedong.com/phpMan.php/man/cat/1/markdown)

## AUTHORS
       Chris Peterson, MIT Project Athena
       Stephen Gildea, X Consortium

X Version 11                               xmessage 1.0.6                                [_XMESSAGE_(1)](https://www.chedong.com/phpMan.php/man/XMESSAGE/1/markdown)
