blob: 5872b5abb23d829e5caf7c4bae93917d9652f6e5 [file] [log] [blame]
Fred Drakec817e271998-08-10 18:40:22 +00001\section{\module{EasyDialogs} ---
Fred Drakef6863c11999-03-02 16:37:17 +00002 Basic Macintosh dialogs}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00003
Fred Drakef6863c11999-03-02 16:37:17 +00004\declaremodule{standard}{EasyDialogs}
5 \platform{Mac}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00006\modulesynopsis{Basic Macintosh dialogs.}
7
Jack Jansenda53c521995-10-10 14:43:20 +00008
Fred Drake41788db1998-04-04 06:23:02 +00009The \module{EasyDialogs} module contains some simple dialogs for
Fred Drakef6863c11999-03-02 16:37:17 +000010the Macintosh, modelled after the
11\module{stdwin}\refbimodindex{stdwin} dialogs with similar names. All
12routines have an optional parameter \var{id} with which you can
13override the DLOG resource used for the dialog, as long as the item
14numbers correspond. See the source for details.
Fred Drake41788db1998-04-04 06:23:02 +000015
16The \module{EasyDialogs} module defines the following functions:
Jack Jansenda53c521995-10-10 14:43:20 +000017
Jack Jansenda53c521995-10-10 14:43:20 +000018
19\begin{funcdesc}{Message}{str}
20A modal dialog with the message text \var{str}, which should be at
21most 255 characters long, is displayed. Control is returned when the
22user clicks ``OK''.
23\end{funcdesc}
24
Fred Drakecce10901998-03-17 06:33:25 +000025\begin{funcdesc}{AskString}{prompt\optional{, default}}
Fred Drake41788db1998-04-04 06:23:02 +000026Ask the user to input a string value, in a modal dialog. \var{prompt}
Jack Jansenda53c521995-10-10 14:43:20 +000027is the promt message, the optional \var{default} arg is the initial
28value for the string. All strings can be at most 255 bytes
Fred Drake41788db1998-04-04 06:23:02 +000029long. \function{AskString()} returns the string entered or \code{None}
30in case the user cancelled.
Jack Jansenda53c521995-10-10 14:43:20 +000031\end{funcdesc}
32
Fred Drakecce10901998-03-17 06:33:25 +000033\begin{funcdesc}{AskYesNoCancel}{question\optional{, default}}
Jack Jansenda53c521995-10-10 14:43:20 +000034Present a dialog with text \var{question} and three buttons labelled
35``yes'', ``no'' and ``cancel''. Return \code{1} for yes, \code{0} for
36no and \code{-1} for cancel. The default return value chosen by
37hitting return is \code{0}. This can be changed with the optional
38\var{default} argument.
39\end{funcdesc}
40
Fred Drake41788db1998-04-04 06:23:02 +000041\begin{funcdesc}{ProgressBar}{\optional{label\optional{, maxval}}}
42Display a modeless progress dialog with a thermometer bar. \var{label}
43is the text string displayed (default ``Working...''), \var{maxval} is
44the value at which progress is complete (default \code{100}). The
45returned object has one method, \code{set(\var{value})}, which sets
46the value of the progress bar. The bar remains visible until the
47object returned is discarded.
Jack Jansen350b2b91995-11-14 10:30:27 +000048
49The progress bar has a ``cancel'' button, but it is currently
50non-functional.
51\end{funcdesc}
52
Fred Drake41788db1998-04-04 06:23:02 +000053Note that \module{EasyDialogs} does not currently use the notification
Jack Jansenda53c521995-10-10 14:43:20 +000054manager. This means that displaying dialogs while the program is in
Jack Jansen350b2b91995-11-14 10:30:27 +000055the background will lead to unexpected results and possibly
56crashes. Also, all dialogs are modeless and hence expect to be at the
57top of the stacking order. This is true when the dialogs are created,
58but windows that pop-up later (like a console window) may also result
59in crashes.