DIALOG(2) DIALOG(2)
NAME
dialog: prompt, getstring - basic dialog boxes
SYNOPSIS
include "dialog.m";
dialog := load Dialog Dialog->PATH;
init: fn();
prompt: fn(ctxt: ref Draw->Context, p: ref Draw->Image,
icon, title, msg: string,
dflt: int, labs: list of string): int;
getstring: fn(ctxt: ref Draw->Context, p: ref Draw->Image,
s: string): string;
DESCRIPTION
Dialog module provides two simple dialog boxes for use by
wm(1) applications. Init should be called once to ini-
tialise its internal state.
Prompt uses the graphics context ctxt to pop up a dialog box
to prompt the user to choose from a set of alternatives, or
to acknowledge a message. The box is created near the
northwest corner of the parent window p, represented by the
window's image. (If the parent window is a Tk Toplevel t,
for instance, the appropriate value is t.image.) If p is
nil, the box is centred on the screen. The box has the
given title and an optional icon. It displays the given msg
and a number of buttons, labelled with the strings in labs.
The dialog box waits for the user to push a button, and then
returns the index of the button pushed (the first element of
labs is index 0). If the user types a newline, the dflt
value is returned. The button with the dflt index is spe-
cially outlined in the dialog box.
Getstring pops up a dialog box near the parent window p. The
box contains the msg and an entry widget. It waits for the
user to type a string and a newline, and then returns the
typed string, without the newline.
SOURCE
/appl/lib/dialog.b
SEE ALSO
draw-context(2), tk(2), wmlib(2)
Page 1 Plan 9 (printed 11/1/25)