home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 10
/
Fresh_Fish_10_2352.bin
/
new
/
dev
/
obero
/
oberon-a
/
examples
/
libraries
/
intuition
/
talk2boopsi.mod
< prev
next >
Wrap
Text File
|
1995-07-02
|
5KB
|
158 lines
(*************************************************************************
$RCSfile: Talk2boopsi.mod $
Description: A port of Talk2boopsi.c
"This example creates a Boopsi prop gadget and integer
string gadget, connecting them so they update each other
when the user changes their value. The example program
only initializes the gadgets and puts them on the window;
it doesn't have to interact with them to make them talk
to each other."
Created by: fjc (Frank Copeland)
$Revision: 1.5 $
$Author: fjc $
$Date: 1995/01/25 23:52:19 $
Copyright © 1994-1995, Frank Copeland.
This example program is part of Oberon-A.
See Oberon-A.doc for conditions of use and distribution.
*************************************************************************)
<* STANDARD- *>
MODULE Talk2boopsi;
IMPORT SYS := SYSTEM, Kernel, E := Exec, U := Utility, I := Intuition;
CONST
VersionTag = "$VER: Talk2boopsi 1.3 (23.1.95)";
VAR
w : I.WindowPtr;
msg : I.IntuiMessagePtr;
prop, integer : I.GadgetPtr;
prop2intmap, int2propmap : ARRAY 2 OF U.TagItem;
CONST
propGadgetID = 1;
intGadgetID = 2;
propGadgetWidth = 10;
propGadgetHeight = 80;
intGadgetHeight = 18;
visible = 10;
total = 100;
initialVal = 25;
minWindowWidth = 80;
minWindowHeight = propGadgetHeight + 70;
maxChars = 3;
(*------------------------------------*)
PROCEDURE* Cleanup (VAR rc : LONGINT);
BEGIN (* Cleanup *)
IF integer # NIL THEN
SYS.PUTREG (0, I.RemoveGList (w, prop, -1));
I.DisposeObject (integer);
END;
IF prop # NIL THEN
I.DisposeObject (prop);
END;
IF w # NIL THEN
I.CloseWindow (w);
END;
END Cleanup;
(*------------------------------------*)
PROCEDURE Init ();
BEGIN (* Init *)
prop2intmap [0].tag := I.pgaTop;
prop2intmap [0].data := I.stringaLongVal;
prop2intmap [1].tag := U.end;
int2propmap [0].tag := I.stringaLongVal;
int2propmap [0].data := I.pgaTop;
int2propmap [1].tag := U.end;
w := NIL; prop := NIL; integer := NIL;
Kernel.SetCleanup (Cleanup);
END Init;
(*------------------------------------*)
PROCEDURE Main ();
VAR done : BOOLEAN;
BEGIN (* Main *)
done := FALSE;
(*
Open the window -- notice that the window's IDCMP port does not
listen for GADGETUP messages.
*)
w := I.OpenWindowTagsA (
NIL,
I.waFlags, { I.windowDepth, I.windowDrag,
I.windowClose, I.windowSizing },
I.waIDCMP, { I.closeWindow },
I.waMinWidth, minWindowWidth,
I.waMinHeight, minWindowHeight,
U.end );
IF w # NIL THEN
(* Create a new propgclass object *)
prop := I.NewObject ( NIL, "propgclass",
I.gaID, propGadgetID,
I.gaTop, w.borderTop + 5,
I.gaLeft, w.borderLeft + 5,
I.gaWidth, propGadgetWidth,
I.gaHeight, propGadgetHeight,
I.icaMap, SYS.ADR (prop2intmap),
I.pgaTotal, total,
I.pgaTop, initialVal,
I.pgaVisible, visible,
I.pgaNewLook, TRUE,
U.end );
IF prop # NIL THEN
(* Create the integer string gadget *)
integer := I.NewObject ( NIL, "strgclass",
I.gaID, intGadgetID,
I.gaTop, w.borderTop + 5,
I.gaLeft, w.borderLeft + propGadgetWidth + 5,
I.gaWidth, minWindowWidth -
( w.borderLeft + w.borderRight +
propGadgetWidth + 15 ),
I.gaHeight, intGadgetHeight,
I.icaMap, SYS.ADR (int2propmap),
I.icaTarget, prop,
I.gaPrevious, prop,
I.stringaLongVal, initialVal,
I.stringaMaxChars, maxChars,
U.end );
IF integer # NIL THEN
SYS.PUTREG (0, I.SetGadgetAttrs (
prop^, w, NIL,
I.icaTarget, integer,
U.end ));
SYS.PUTREG (0, I.AddGList (w, prop, -1, -1, NIL));
I.RefreshGList (prop, w, NIL, -1);
WHILE ~done DO
E.WaitPort (w.userPort);
LOOP
msg :=
SYS.VAL (I.IntuiMessagePtr, E.GetMsg (w.userPort));
IF msg = NIL THEN EXIT END;
IF msg.class = {I.closeWindow} THEN done := TRUE END;
E.ReplyMsg (msg);
END
END
END
END
END
END Main;
BEGIN (* Talk2boopsi *)
Init ();
Main ();
END Talk2boopsi.