# jalert.tcl

## Introduction

The jalert.tcl library is distributed as part of the jstools package. It provides a modal alert panel you can use to present notices to your users. It's fairly intrusive, so it should be used sparingly.
This document describes jalert.tcl version 2001.02.10.

## Usage

### Accessing the Library

In order to use the jalert.tcl library, it (and any other libraries it depends on) must be in your Tcl `auto_path`, described in `tclvars`(n). Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.

## Credits and Copyright

### Author

Jay Sekora
`js@aq.org`
`http://www.aq.org/~js/`

### Copyright

The library is copyright © 1992-2001 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.

## Overview

### Procedure

`::jstools::alert` - alert panel

## ::jstools::alert

### Usage

`::jstools::alert` [options]

### Options

`-title` title`(`default `Alert`)
`-text` text`(`default `Alert!` - not really optional)

### Example

`::jstools::alert -title Error -text \
"File \"$file\" not found."`

### Description

This prodedure creates a popup alert window displaying the text text (in a message widget), with an OK button which will make the alert box go away and return control to your application.

If title is specified, it will be the title of the panel, for use by the window manager.

If the global variable `J_PREFS(autoposition)` is true, the panel will be (approximately) centred on the screen by the `j:dialogue` procedure (in jtkutils.tcl).

### Note

Neither title nor text is automatically localised; you should convert them to their localised forms using the procedures in jldb.tcl (the `jldb` package) before calling `::jstools::alert`.

## Future Directions

- You should be able to specify a class for the toplevel panel.
- There should be a way to specify how important a particular notice is, and a user preference for how important a notice has to be in order actually to be displayed (along the lines of the `j:confirm` panel).
- There should be a way to create non-modal panels with callbacks.
- There should be a way for the user to copy-and-paste the text of the alert panel (e.g. for reporting errors).

`
`