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