blob: 7f5237b0ed18c5d7ee1b5eb72330f2204dc64704 [file] [log] [blame]
Fred Drake41788db1998-04-04 06:23:02 +00001\section{Standard Module \module{EasyDialogs}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-EasyDialogs}
Jack Jansenda53c521995-10-10 14:43:20 +00003\stmodindex{EasyDialogs}
4
Fred Drake41788db1998-04-04 06:23:02 +00005The \module{EasyDialogs} module contains some simple dialogs for
6the Macintosh, modelled after the \module{stdwin} dialogs with similar
Guido van Rossume229d861997-08-18 15:14:26 +00007names. All routines have an optional parameter \var{id} with which you
8can override the DLOG resource used for the dialog, as long as the
9item numbers correspond. See the source for details.
Fred Drake41788db1998-04-04 06:23:02 +000010
11The \module{EasyDialogs} module defines the following functions:
Jack Jansenda53c521995-10-10 14:43:20 +000012
Jack Jansenda53c521995-10-10 14:43:20 +000013
14\begin{funcdesc}{Message}{str}
15A modal dialog with the message text \var{str}, which should be at
16most 255 characters long, is displayed. Control is returned when the
17user clicks ``OK''.
18\end{funcdesc}
19
Fred Drakecce10901998-03-17 06:33:25 +000020\begin{funcdesc}{AskString}{prompt\optional{, default}}
Fred Drake41788db1998-04-04 06:23:02 +000021Ask the user to input a string value, in a modal dialog. \var{prompt}
Jack Jansenda53c521995-10-10 14:43:20 +000022is the promt message, the optional \var{default} arg is the initial
23value for the string. All strings can be at most 255 bytes
Fred Drake41788db1998-04-04 06:23:02 +000024long. \function{AskString()} returns the string entered or \code{None}
25in case the user cancelled.
Jack Jansenda53c521995-10-10 14:43:20 +000026\end{funcdesc}
27
Fred Drakecce10901998-03-17 06:33:25 +000028\begin{funcdesc}{AskYesNoCancel}{question\optional{, default}}
Jack Jansenda53c521995-10-10 14:43:20 +000029Present a dialog with text \var{question} and three buttons labelled
30``yes'', ``no'' and ``cancel''. Return \code{1} for yes, \code{0} for
31no and \code{-1} for cancel. The default return value chosen by
32hitting return is \code{0}. This can be changed with the optional
33\var{default} argument.
34\end{funcdesc}
35
Fred Drake41788db1998-04-04 06:23:02 +000036\begin{funcdesc}{ProgressBar}{\optional{label\optional{, maxval}}}
37Display a modeless progress dialog with a thermometer bar. \var{label}
38is the text string displayed (default ``Working...''), \var{maxval} is
39the value at which progress is complete (default \code{100}). The
40returned object has one method, \code{set(\var{value})}, which sets
41the value of the progress bar. The bar remains visible until the
42object returned is discarded.
Jack Jansen350b2b91995-11-14 10:30:27 +000043
44The progress bar has a ``cancel'' button, but it is currently
45non-functional.
46\end{funcdesc}
47
Fred Drake41788db1998-04-04 06:23:02 +000048Note that \module{EasyDialogs} does not currently use the notification
Jack Jansenda53c521995-10-10 14:43:20 +000049manager. This means that displaying dialogs while the program is in
Jack Jansen350b2b91995-11-14 10:30:27 +000050the background will lead to unexpected results and possibly
51crashes. Also, all dialogs are modeless and hence expect to be at the
52top of the stacking order. This is true when the dialogs are created,
53but windows that pop-up later (like a console window) may also result
54in crashes.