SimpleStreamsOnXTest.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, August 26, 1988 11:12:22 am PDT
Christian Jacobi, March 27, 1992 4:42 pm PST
DIRECTORY
Atom, Commander, IO, Rope, SafeStorage, SimpleStreams, XTkWidgets, XTk;
SimpleStreamsOnXTest: CEDAR MONITOR
IMPORTS Atom, Commander, IO, SimpleStreams, XTkWidgets =
BEGIN
Debug: PROC [echo: BOOL, key: REF¬$X] = {
ch: CHAR; in, out: IO.STREAM;
[in, out] ¬ SimpleStreams.Create["test", echo, key];
DO
ch ¬ IO.GetChar[in];
IF ch=4C THEN EXIT;
IO.PutChar[out, ch ! IO.Error => GOTO oops];
ENDLOOP;
EXITS oops => {};
};
CreatorRec: TYPE = RECORD [
nameWidget: XTkWidgets.Widget
];
CreateAHandler: XTk.WidgetNotifyProc = {
cr: REF CreatorRec ~ NARROW[registerData];
echo: BOOL ¬ callData=$Echo;
name: Rope.ROPE ¬ XTkWidgets.GetText[cr.nameWidget];
Debug[echo, Atom.MakeAtom[name]];
};
HandlerCreator: Commander.CommandProc ~ {
cr: REF CreatorRec ~ NEW[CreatorRec];
button1: XTkWidgets.Widget ¬ XTkWidgets.CreateButton[text: "<test with echo>", hitProc: CreateAHandler, registerData: cr, callData: $Echo];
button2: XTkWidgets.Widget ¬ XTkWidgets.CreateButton[text: "<test without echo>", hitProc: CreateAHandler, registerData: cr];
nameWidget: XTkWidgets.Widget ¬ cr.nameWidget ¬ XTkWidgets.CreateLabeledField[label: "(WindowSystem) name:", init: "X"];
container: XTkWidgets.Widget ¬ XTkWidgets.CreateYStack[[], LIST[button1, button2, nameWidget]];
shell: XTkWidgets.Widget ¬ XTkWidgets.CreateShell[child: container, windowHeader: "Tester for SimpleStreams", standardMigration: TRUE];
XTkWidgets.RealizeShell[shell];
};
Commander.Register["SimpleStreamsonXTest", HandlerCreator, "Create a simple stream tester widget"];
END.