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