Fred Drake | b78da33 | 1997-12-17 14:12:31 +0000 | [diff] [blame] | 1 | \section{Standard Module \sectcode{EasyDialogs}} |
Guido van Rossum | e47da0a | 1997-07-17 16:34:52 +0000 | [diff] [blame] | 2 | \label{module-EasyDialogs} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 3 | \stmodindex{EasyDialogs} |
| 4 | |
| 5 | The \code{EasyDialogs} module contains some simple dialogs for |
| 6 | the Macintosh, modelled after the \code{stdwin} dialogs with similar |
Guido van Rossum | e229d86 | 1997-08-18 15:14:26 +0000 | [diff] [blame] | 7 | names. All routines have an optional parameter \var{id} with which you |
| 8 | can override the DLOG resource used for the dialog, as long as the |
| 9 | item numbers correspond. See the source for details. |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 10 | |
| 11 | The \code{EasyDialogs} module defines the following functions: |
| 12 | |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 13 | \setindexsubitem{(in module EasyDialogs)} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 14 | |
| 15 | \begin{funcdesc}{Message}{str} |
| 16 | A modal dialog with the message text \var{str}, which should be at |
| 17 | most 255 characters long, is displayed. Control is returned when the |
| 18 | user clicks ``OK''. |
| 19 | \end{funcdesc} |
| 20 | |
| 21 | \begin{funcdesc}{AskString}{prompt\optional{\, default}} |
| 22 | Ask the user to input a string value, in a modal dialog. \var{Prompt} |
| 23 | is the promt message, the optional \var{default} arg is the initial |
| 24 | value for the string. All strings can be at most 255 bytes |
| 25 | long. \var{AskString} returns the string entered or \code{None} in |
| 26 | case the user cancelled. |
| 27 | \end{funcdesc} |
| 28 | |
| 29 | \begin{funcdesc}{AskYesNoCancel}{question\optional{\, default}} |
| 30 | Present a dialog with text \var{question} and three buttons labelled |
| 31 | ``yes'', ``no'' and ``cancel''. Return \code{1} for yes, \code{0} for |
| 32 | no and \code{-1} for cancel. The default return value chosen by |
| 33 | hitting return is \code{0}. This can be changed with the optional |
| 34 | \var{default} argument. |
| 35 | \end{funcdesc} |
| 36 | |
Jack Jansen | 350b2b9 | 1995-11-14 10:30:27 +0000 | [diff] [blame] | 37 | \begin{funcdesc}{ProgressBar}{\optional{label\, maxval}} |
| 38 | Display a modeless progress dialog with a thermometer bar. \var{Label} |
| 39 | is the textstring displayed (default ``Working...''), \var{maxval} is |
| 40 | the value at which progress is complete (default 100). The returned |
| 41 | object has one method, \code{set(value)}, which sets the value of the |
| 42 | progress bar. The bar remains visible until the object returned is |
| 43 | discarded. |
| 44 | |
| 45 | The progress bar has a ``cancel'' button, but it is currently |
| 46 | non-functional. |
| 47 | \end{funcdesc} |
| 48 | |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 49 | Note that \code{EasyDialogs} does not currently use the notification |
| 50 | manager. This means that displaying dialogs while the program is in |
Jack Jansen | 350b2b9 | 1995-11-14 10:30:27 +0000 | [diff] [blame] | 51 | the background will lead to unexpected results and possibly |
| 52 | crashes. Also, all dialogs are modeless and hence expect to be at the |
| 53 | top of the stacking order. This is true when the dialogs are created, |
| 54 | but windows that pop-up later (like a console window) may also result |
| 55 | in crashes. |