blob: 546065f8bf39bf287badb7c5fb4ca99773fb3513 [file] [log] [blame]
Fred Drakeb78da331997-12-17 14:12:31 +00001\section{Standard Module \sectcode{EasyDialogs}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-EasyDialogs}
Jack Jansenda53c521995-10-10 14:43:20 +00003\stmodindex{EasyDialogs}
4
5The \code{EasyDialogs} module contains some simple dialogs for
6the Macintosh, modelled after the \code{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.
Jack Jansenda53c521995-10-10 14:43:20 +000010
11The \code{EasyDialogs} module defines the following functions:
12
Fred Drake19479911998-02-13 06:58:54 +000013\setindexsubitem{(in module EasyDialogs)}
Jack Jansenda53c521995-10-10 14:43:20 +000014
15\begin{funcdesc}{Message}{str}
16A modal dialog with the message text \var{str}, which should be at
17most 255 characters long, is displayed. Control is returned when the
18user clicks ``OK''.
19\end{funcdesc}
20
21\begin{funcdesc}{AskString}{prompt\optional{\, default}}
22Ask the user to input a string value, in a modal dialog. \var{Prompt}
23is the promt message, the optional \var{default} arg is the initial
24value for the string. All strings can be at most 255 bytes
25long. \var{AskString} returns the string entered or \code{None} in
26case the user cancelled.
27\end{funcdesc}
28
29\begin{funcdesc}{AskYesNoCancel}{question\optional{\, default}}
30Present a dialog with text \var{question} and three buttons labelled
31``yes'', ``no'' and ``cancel''. Return \code{1} for yes, \code{0} for
32no and \code{-1} for cancel. The default return value chosen by
33hitting return is \code{0}. This can be changed with the optional
34\var{default} argument.
35\end{funcdesc}
36
Jack Jansen350b2b91995-11-14 10:30:27 +000037\begin{funcdesc}{ProgressBar}{\optional{label\, maxval}}
38Display a modeless progress dialog with a thermometer bar. \var{Label}
39is the textstring displayed (default ``Working...''), \var{maxval} is
40the value at which progress is complete (default 100). The returned
41object has one method, \code{set(value)}, which sets the value of the
42progress bar. The bar remains visible until the object returned is
43discarded.
44
45The progress bar has a ``cancel'' button, but it is currently
46non-functional.
47\end{funcdesc}
48
Jack Jansenda53c521995-10-10 14:43:20 +000049Note that \code{EasyDialogs} does not currently use the notification
50manager. This means that displaying dialogs while the program is in
Jack Jansen350b2b91995-11-14 10:30:27 +000051the background will lead to unexpected results and possibly
52crashes. Also, all dialogs are modeless and hence expect to be at the
53top of the stacking order. This is true when the dialogs are created,
54but windows that pop-up later (like a console window) may also result
55in crashes.