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