# jmore.tcl

## Introduction

The jmore.tcl library provides procedures for displaying (potentially long) text, such as the contents of a file or the output of a command. (For short notices, `j:alert` from the jalert.tcl library may be more appropriate.)

The jmore.tcl library is distributed as part of the jstools package.

This document describes jmore.tcl version 2001.02.10.

## Usage

### Accessing the Library

In order to use the jmore.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

### Procedures

`::jstools::more` - display text in window

## ::jstools::more

### Usage

`::jstools::more` [options]

### Options

`-title` title`` (default `{}`)
`-text` text`` (default `{}` - not really optional)
`-annotation` annotation`` (default `{}`)
`-height` h`` (default `24`)
`-width` w`` (default `80`)
`-wrap` wrap`` (default ``char`')
`-font` font`` (default ``default`')
`-class` class`` (default ``More`')

### Example

`set helpFile [open "help.doc"]
::jstools::more -title "Application Help" -text [read $helpFile]
close $helpFile`

### Note

In prior versions of jstools, the argument to the `-text` option was automatically localized. In the current version it is not.

### Description

This procedure creates a new nonmodal toplevel window with a text widget containing text, a scrollbar, and a set of buttons. The toplevel will have the title title, and the window class class, which can be used for specifying X resources or windowmanager behaviour. The text widget will be h lines tall and w characters wide, and its contents will be displayed in the font font. (If font is ``default`', then the X Windows default font for the `::jstools::more` text widget will be used.) Its lines will be wrapped according to wrap, which can be `line`, `char`, or `none`.

If annotation is specified (and is nonnull), it is annotation (tags and marks) to be applied to text, in the format implemented by the jtexttags.tcl library and created by `jedit`'s `richtext` mode, and it will be displayed with appropriate formatting. (Note that you may want wrap to be `word` in this case.)

The text widget will be disabled, so the user can't alter its contents.

Pressing Space, Next or PageDown, or Control-v will scroll the text down, and pressing b, Prior or PageUp, or Escape-v will scroll the text up.

Four buttons will appear at the bottom of the window, labelled `Find...', `Print', `Save', and `Close'.

#### Close

`Close' is the default button (i.e., Return will invoke it), and it destroys the window.

#### Save

`Save' lets the user save the contents of the window into a file.

#### Print

`Print' displays a confirmation panel, and, if the user clicks OK, prints the contents of the `::jstools::more` window to the printer named by the global variable `J_PREFS(printer)` (or `lp` if `J_PREFS(printer)` is not set), using the `lpr` command.

#### Find...

`Find...' brings up a Find panel that lets you search for a string in the text.

The `::jstools::more` procedure returns the pathname of the text widget, in case the caller wants to further configure it or manipulate its contents.

## Bugs and Limitations

- The term `more` isn't likely to be intuitive to non-Unix users.

## Future Directions

- There should be a way to specify which buttons you want on a `::jstools::more` panel, and to add applicationspecific buttons.
- There should be independent global preferences for the size, font, and colour of `::jstools::more` text widgets.
- Interaction with the find panel should be made more intuitive.
  There needs to be error checking in `::jstools::more:print` and `::jstools::more:save`.

`
`