# The KMessage Handbook

Jeroen S. Wijnhout

    wijnhout@science.uva.nl

2003 Jeroen S. Wijnhout
&FDLNotice;
22/03/2003
0.01.00

&kmessage; is a little program that is able to display a message window with configurable buttons. &kmessage; is the KDE equivalent of xmessage. It is intended to be used within a KDE environment and to invoked from the command line or from scripts.

KDE kdeutils KMessage message

## Introduction

This program reads a message (which is specified as a parameter or is read from a file or standard input) and displays this message in a window. Beneath the message a row of numbers, as specified by the command line argument -buttons, is displayed. The program exits when a buttons is clicked, which button is pressed can be derived from the return value of &kmessage;, optionally the name of the button is printed to standard output.

## Using KMessage

### Command line arguments

&kmessage; handles various command line arguments (including all the KDE and Qt command line arguments). The general syntax is:

``kmessage [ `-center` ] [ `-nearmouse` ] [ `-print` ] [ `-buttons` buttons ] [ `-default` default ][ `-file` `file` ] [ `-timeout` timeout ] message``

`-center`

  Forces &kmessage; to position the window in the center of the screen.

`-nearmouse`

  Forces &kmessage; to position the upper-left corner of the window near the mouse pointer.

`-print`

  The name of the button that is clicked is written to standard output.

`-buttons` buttons

  Displays a row of buttons as specified in buttons. buttons should be a comma-separated list (without spaces!) of the names of the buttons. buttons defaults to okay.

  If buttons is specified the return value of &kmessage; will be 100+the number of the button pressed (counting from one). In the case that buttons is not specified explicitly on the command line the return value will be 0 (on normal exit).

`-default` default

  Gives keyboard focus to the button default. It is wise to give focus to the button that represents the safest choice.

`-file` `file`

  Displays the contents of the file `file`. If `file` is equal to - then input is read from standard input until a EOF is encountered.

`-timeout` timeout

  Displays the window only for timeout seconds.

To get all the available Qt and KDE command line options (such as setting the caption of the window) just type in:

``kmessage --help-all``

### Examples

The command ``echo 'hi!' | kmessage -title "Just a message" -center -file - -buttons 'great!','so what?' -print`` produces the following output: Here's a screenshot of &kapp;

Screenshot
The command ``kmessage -file COPYING -buttons G,N,U,Public,License -title GPL`` produces the following output: Here's a screenshot of &kapp;
Screenshot

## Questions and Answers

&reporting.bugs; &updating.documentation;

q1

a1

## Credits and License

&kapp;

Program copyright 2003 Jeroen Wijnhout wijnhout@science.uva.nl

Documentation copyright 2003 Jeroen Wijnhout wijnhout@science.uva.nl

&underFDL; &underGPL;

## Installation

### How to obtain KMessage

&kmessage; is part of the KDE project http://www.kde.org. &kmessage; can be found in the kdeutils package on ftp://ftp.kde.org/pub/kde/, the main ftp site of the KDE project.

### Requirements

In order to successfully use &kmessage;, you need KDE 3.1.

All required libraries as well as &kmessage; itself can be found on The &kmessage; home page.

You can find a list of changes at http://apps.kde.org/kmessage.

### Compilation and Installation

In order to compile and install &kmessage; on your system, type the following in the base directory of the Icon Editor distribution:

    % ./configure
    % make
    % make install

Since &kmessage; uses autoconf and automake you should have not trouble compiling it. Should you run into problems please report them to the KDE mailing lists.

&documentation.index;