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