home *** CD-ROM | disk | FTP | other *** search
- (****************************************************************************
-
- $RCSfile: RequesterExample.mod $
-
- $Revision: 1.3 $
- $Date: 1994/09/14 17:41:39 $
-
- GUIEnvironment example: Requester
-
- M2Amiga Modula-2 Compiler V4.3
-
- Copyright © 1994, Carsten Ziegeler
- Augustin-Wibbelt-Str.7, 33106 Paderborn, Germany
-
- ****************************************************************************)
- MODULE RequesterExample;
-
- (* This example shows all available requesters on the public screen.
- The requesters are not redirected ! The windowPtr field of the
- process structure is used ! (Usually this is NIL) *)
-
- FROM SYSTEM IMPORT ADR, ADDRESS, TAG;
- IMPORT D : GUIEnvD,
- L : GUIEnvL;
-
- CONST version = ADR("$VER: RequesterExample 1.3 (14.09.94)\n");
-
- VAR choose : LONGINT;
- file, dir : ARRAY[0..255] OF CHAR;
- tagbuf : ARRAY[0..19] OF LONGCARD;
- args : ARRAY[0..4] OF ADDRESS; (* for the arguments *)
-
- BEGIN
-
- (* Return value not needed, ok requester *)
- IGNORE L.GUIRequestA(NIL, ADR("This is the requester demo !\nEnjoy it !"),
- D.gerOKKind, NIL);
-
- (* doitReqKind *)
- WHILE L.GUIRequestA(NIL, ADR("Do you want to see this requester again ?"),
- D.gerDoItKind, NIL) = D.gerYes DO
- END;
-
- (* Yes/no/cancel requester *)
- choose := L.GUIRequestA(NIL, ADR("Do you want to see some asl requesters ?"),
- D.gerYNCKind, NIL);
- IF choose = D.gerYes THEN
-
- (* And now the asl requesters supported by GUIEnvironment *)
-
- file := "guienv.library";
- dir := "sys:libs";
-
- (* First a requester to choose the best library ! *)
- IF L.GUIRequestA(NIL, ADR("Choose the best library"), D.gerFileKind,
- TAG(tagbuf, D.gerPattern, ADR("#?.library"),
- D.gerFileBuffer, ADR(file),
- D.gerDirBuffer, ADR(dir), NIL)) = D.gerYes THEN
- args[0] := ADR(dir);
- args[1] := ADR(file);
- IGNORE L.GUIRequestA(NIL, ADR("You choice was:\ndir : %s\nfile: %s"),
- D.gerOKKind, TAG(tagbuf, D.gerArgs, ADR(args), NIL));
- ELSE
- IGNORE L.GUIRequestA(NIL, ADR("You cancelled it ! (Sniff..)"),
- D.gerOKKind, NIL);
- END;
-
- (* And now a save dir requester with no pattern gadget *)
- dir := "ram:t";
- IF L.GUIRequestA(NIL, ADR("Choose directory to save something..."),
- D.gerDirKind, TAG(tagbuf, D.gerNameBuffer, ADR(dir),
- D.gerPattern, NIL,
- D.gerSave, TRUE, NIL)) = D.gerYes THEN
-
- args[0] := ADR(dir);
- IGNORE L.GUIRequestA(NIL, ADR("You selected directory:\n%s"),
- D.gerOKKind, TAG(tagbuf, D.gerArgs, ADR(args), NIL));
- ELSE
- IGNORE L.GUIRequestA(NIL, ADR("You cancelled it ! (Snuff..)"),
- D.gerOKKind, NIL);
- END;
-
- ELSIF choose = D.gerNo THEN
- IGNORE L.GUIRequestA(NIL, ADR("Click OK to quit !"), D.gerOKKind, NIL);
- END;
-
- END RequesterExample.
-