home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: EasyRequest.mod $
- Description:
-
- Created by: fjc (Frank Copeland)
- $Revision: 1.4 $
- $Author: fjc $
- $Date: 1995/01/25 23:52:19 $
-
- Copyright © 1994, Frank Copeland.
- This example program is part of Oberon-A.
- See Oberon-A.doc for conditions of use and distribution.
-
- *************************************************************************)
-
- <* STANDARD- *>
-
- MODULE EasyRequest;
-
- IMPORT SYS := SYSTEM, e := Exec, d := Dos, i := Intuition, WbConsole;
-
- CONST
- VersionTag = "$VER: EasyRequest 1.4 (24.1.95)\r\n";
-
- (*------------------------------------*)
- VAR
-
- myES : i.EasyStruct;
-
-
- (*------------------------------------
- ** Initialise the easy request structure.
- ** This uses many features of EasyRequest(), including:
- ** multiple lines of body text seperated by '\n'.
- ** variable substitution of a string (%s) in the body text.
- ** multiple button gadgets separated by '|'.
- ** variable substitution in a gadget (long decimal '%ld').
- *)
- PROCEDURE Init ();
-
- BEGIN (* Init *)
- myES.structSize := SIZE (i.EasyStruct);
- myES.flags := {};
- myES.title := SYS.ADR ("Request Window Name");
- myES.textFormat :=
- SYS.ADR ( "Text for the request\n"
- "Second line of %s text\n"
- "Third line of text for the request");
- myES.gadgetFormat := SYS.ADR ("Yes|%ld|No");
- END Init;
-
- (*------------------------------------*)
- PROCEDURE Main ();
-
- VAR
- answer, number : LONGINT;
-
- BEGIN (* Main *)
- number := 3125794; (* For use in the middle button *)
- (* note in the variable substitution:
- ** the string goes in the first open variable (in body text).
- ** the number goes in the second open (gadget text).
- *)
- answer :=
- i.EasyRequest
- ( NIL, SYS.ADR (myES), NIL,
- SYS.ADR ("(Variable)"),
- number );
-
- (* Process the answer. Note that the buttons are numbered in
- ** a strange order. This is because the rightmost button is
- ** always a negative reply. The code can use this if it chooses,
- ** with a construct like:
- **
- ** IF EasyRequest() > 0 THEN
- ** PositiveResponse ()
- ** END
- *)
- CASE answer OF
- 1 : d.PrintF ("selected 'Yes'\n", NIL)
- |
- 2 : d.PrintF ("selected '%ld'\n", number)
- |
- 0 : d.PrintF ("selected 'No'\n", NIL)
- |
- ELSE
- END;
- END Main;
-
- BEGIN (* EasyRequest *)
- ASSERT (i.base.libNode.version >= 37);
- Init ();
- Main ();
- END EasyRequest.
-