jprefpanel.tcl

Introduction

The jprefpanel.tcl library is distributed as part of the jstools package. It a single procedure which creates the jstools Global Preferences panel.

This document describes jprefpanel.tcl version 4.1/4.4.

Usage

Accessing the Library


In order to use the jprefpanel.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-1996 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.

Overview

Procedures

j:global_pref_panel - create the jstools Global Preferences panel
j:pref:string_ui - labelled UI for global variable (undocumented)
j:pref:boolean_ui
- labelled UI for global variable (undocumented)
j:pref:radio_ui
- labelled UI for global variable (undocumented)
j:pref:show_module - cause panel to show prefs for module
j:pref:module_ui
- create pref panel for module (undocumented)
j:pref:create_panel
- create a preferences panel (undocumented)
j:pref:show_panel - create and display a preferences panel

See Also

jprefs.tcl

j:global_pref_panel

Usage

j:global_pref_panel [options]

Option

-title title (localisable, default Global Preferences)

Description

This procedure creates a preference panel that lets users set preferences intended to be shared across multiple applications. Global preferences are accessed by applications as elements of the global J_PREFS array, and saved as Tcl code in the file ~/.tk/defaults.

The main part of the panel contains various kinds of controls to manipulate particular preferences. At the bottom of the panel are two buttons labelled `Save' and `Done'. (Save is the default button.) The Done button simply dismisses the panel; the application will use whatever preferences are currently shown, but they will not be saved across sessions. The Save button writes the current preferences into the file ~/.tk/defaults before dismissing the panel, so that they can be read in the next time the application starts, or by other applications.

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

Documentation for the Global Preferences panel itself (as opposed to the library) is available in The jstools Global Preferences Panel.

Currently, the controls available and the preferences they manipulate are:

Auto­position dialogue boxes

Checkbutton; sets J_PREFS(autoposition)
(Used by j:dialogue)

Confirm actions

Checkbutton; sets J_PREFS(confirm)
(Used by j:alert)

Fast file selector

Checkbutton; sets J_PREFS(j_fs_fast)
(Used by j:fs)

Visible Bell

Checkbutton; sets J_PREFS(visiblebell)
(Used by j:beep)

Audible Bell

Checkbutton; sets J_PREFS(audiblebell)
(Used by j:beep)

Strict Motif emulation

Checkbutton; sets J_PREFS(tk_strictMotif) and tk_strictMotif
(Used by Tk itself. Changing this preference currently has no effect until the next time the application is run; this might be considered a bug.)

Basic bindings

Radiobutton; sets J_PREFS(bindings) to basic
(Used by j:init; can also be checked by your code.)

vi bindings

Radiobutton; sets J_PREFS(bindings) to vi
(Used by j:init; can also be checked by your code.)

EDT bindings

Radiobutton; sets J_PREFS(bindings) to EDT
(Used by j:init; can also be checked by your code.)

Emacs bindings

Radiobutton; sets J_PREFS(bindings) to emacs
(Used by j:init; can also be checked by your code.)

Printer:

Entry field; sets J_PREFS(printer)
(Used by j:more; can also be used by your application. Note that in the current version of the library, it does not set the PRINTER environment variable.)

In addition to using commands in the jbindings.tcl or jinit.tcl libraries to set default text and entry bindings, your application may wish to consult the value of J_PREFS(bindings) in order to choose bindings for commands that it defines. For instance, you may wish to use `/' (a slash) to start a search if the user has selected vi or basic bindings, but Control-s if the user has selected Emacs bindings. Likewise, you might bind either `ZZ' or Control-x Control-q to save a document, depending on the user's preferred bindings.

Additional global preferences are likely to be defined in future versions of the library.

j:pref:string_ui

Description

This procedure creates the user interface to control a string­valued preference. It's mainly intended to be used by j:pref:module_ui, and is not yet documented.

j:pref:boolean_ui

Description

This procedure creates the user interface to control a boolean­valued preference. It's mainly intended to be used by j:pref:module_ui, and is not yet documented.

j:pref:radio_ui

Description

This procedure creates the user interface to control a one­of­many preference. It's mainly intended to be used by j:pref:module_ui, and is not yet documented.

j:pref:show_module

Usage

j:pref:show_module [module]

Arguments

module - the module to display

Description

This procedure displays the interface for the preferences in module, creating the panel containing module if necessary. It's used by the option menu at the top of a preferences panel, but you can also call it from your own code. For instance, if you had a printing panel, you might want to put a button on it that would allow the user to set printing­related preferences.

j:pref:module_ui

Description

This procedure creates the user interface corresponding to a particular preferences module. It's mainly intended to be used by j:pref:show_panel, and is not yet documented.

j:pref:create_panel

Description

This procedure creates a preference panel, but doesn't show one of its modules. It's intended for use by j:pref:show_panel, and is not yet documented.

j:pref:show_panel

Usage

j:pref:show_panel panel

Arguments

panel - the pathname of the panel to create

Example

j:pref:show_panel .editor_prefs

Description

This procedure creates (if necessary) and displays the preferences panel panel, which should previously have been populated by preference modules by j:pref:module and j:pref:preference (both in jprefs.tcl). The first preference module registered for panel will be displayed, with an option menu at the top of the panel for displaying the other modules in panel.