dialog.icn: Procedures for dialogs

procedure TextDialog:      text dialog
procedure ToggleDialog:    toggle dialog
procedure SelectDialog:    selection dialog
procedure Notice:          notice dialog
procedure SaveDialog:      save dialog
procedure OpenDialog:      open dialog
procedure ColorDialog:     color dialog
procedure Popup:           create popup subwindow

link dialog
December 14, 1999; Ralph E. Griswold and Gregg M. Townsend
Requires: Version 9 graphics
This file is in the public domain.

This file contains several procedures for posting dialog boxes:

AskDialog() -- TextDialog() with only caption and "No" instead of "Cancel"
Notice(win, captions) -- notice dialog (a simple text dialog)
TextDialog(win, captions, labels, defaults...) -- text dialog
ToggleDialog(win, captions, labels, defaults...) -- toggle dialog
SelectDialog(win, captions, labels, defaults...) -- selection dialog
SaveDialog(win, caption, filename, len) -- save file dialog
OpenDialog(win, caption, filename, len) -- open file dialog
ColorDialog(win, captions, refcolor, callback, id) -- color dialog

In all cases, the first or only caption is used as a dialog box ID,
used to remember the dialog box location when it is closed.  A later
posting using the same ID places the new box at the same location.
____________________________________________________________

ColorDialog(win, captions, color, callback, id) -- display color dialog

captions     list of dialog box captions; default is ["Select color:"]
color        reference color setting; none displayed if not supplied
callback     procedure to call when the setting is changed
id           arbitrary value passed to callback

ColorDialog displays a dialog window with R/G/B and H/S/V sliders for
color selection.  When the "Okay" or "Cancel" button is pressed,
ColorDialog returns the button name, with the ColorValue of the final
settings stored in the global variable dialog_value.

If a callback procedure is specified, callback(id, k) is called whenever
the settings are changed;  k is the ColorValue of the settings.
____________________________________________________________

Popup(x, y, w, h, proc, args...) creates a subwindow of the specified
size, calls proc(args), and awaits its success or failure.  Then, the
overlaid area is restored and the result of proc is produced.  &window,
as seen by proc, is a new binding of win in which dx, dy, and clipping
have been set.  The usable area begins at (0,0);  its size is
(WAttrib(win, "clipw"), WAttrib(win, "cliph")).  Defaults are:
     x, y    positioned to center the subwindow
     w, h    250, 150
     proc    Event

Source code | Program Library Page | Icon Home Page