home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: EasyRequest.mod $
- Description:
-
- Created by: fjc (Frank Copeland)
- $Revision: 1.2 $
- $Author: fjc $
- $Date: 1994/08/08 16:55:25 $
-
- Copyright © 1994, Frank Copeland.
- This example program is part of Oberon-A.
- See Oberon-A.doc for conditions of use and distribution.
-
- Log entries are at the end of the file.
-
- *************************************************************************)
-
- MODULE EasyRequest;
-
- (*
- ** $C= CaseChk $I= IndexChk $L= LongAdr $N= NilChk
- ** $P- PortableCode $R= RangeChk $S= StackChk $T= TypeChk
- ** $V= OvflChk $Z= ZeroVars
- *)
-
- IMPORT SYS := SYSTEM, e := Exec, d := Dos, i := Intuition;
-
- CONST
- VersionTag = "$VER: EasyRequest 1.1 (5.7.94)";
-
- (*------------------------------------*)
- 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 *)
- IF i.base.version >= 37 THEN
- (* 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.base.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.base.PrintF ("selected 'Yes'\n", NIL)
- |
- 2 : d.base.PrintF ("selected '%ld'\n", number)
- |
- 0 : d.base.PrintF ("selected 'No'\n", NIL)
- |
- ELSE
- END;
- END;
- END Main;
-
- BEGIN (* EasyRequest *)
- Init ();
- Main ();
- END EasyRequest.
-
- (*************************************************************************
-
- $Log: EasyRequest.mod $
- Revision 1.2 1994/08/08 16:55:25 fjc
- Release 1.4
-
- Revision 1.1 1994/06/17 18:19:27 fjc
- Initial revision
-
- *************************************************************************)
-
-