DIRECTORY Commander, Controls, IO, Rope; TestControlsImpl: CEDAR PROGRAM IMPORTS Commander, Controls, IO, Rope ~ BEGIN ProgramData: TYPE ~ REF ProgramDataRec; ProgramDataRec: TYPE ~ RECORD [ button1Bool: BOOL _ TRUE, button2Nat: NAT _ 0 ]; TestControls: Commander.CommandProc ~ { [] _ Controls.OuterViewer[ name: "Test Controls", controls: LIST[ Controls.NewControl[name: "no detents", type: circ, max: 360.0, init: 90.0], Controls.NewControl[name: "1 detent", type: circ, max: 360.0, init: 60.0, detents: LIST[[, 180.0]]], Controls.NewControl[name: "2 detents", type: circ, max: 360.0, init: 45.0, report: FALSE, detents: LIST[[, 45.0], [, 290.0]]], Controls.NewControl[name: "lin", type: vert, max: 1.0, init: 0.3, detents: LIST[[, 0.6]]], Controls.NewControl[name: "log", type: vert, taper: log, max: 1.0, init: 0.3], Controls.NewControl[name: "exp", type: vert, taper: exp, max: 1.0], Controls.NewControl[name: "horizontal", type: horiz, max: 1.0, init: 0.5, w: 200, x: 15, y: 120] ], entries: LIST[ ["Toggle", Button1], ["State 0", Button2], ["Message", Button3], ["Help", Button4] ], typeScript: TRUE, data: NEW[ProgramDataRec] ]; }; Button1: Controls.ClickProc ~ { outerData: Controls.OuterData _ NARROW[clientData]; programData: ProgramData _ NARROW[outerData.data]; programData.button1Bool _ NOT programData.button1Bool; Controls.EntryStyle[outerData, "Toggle", IF programData.button1Bool THEN $BlackOnWhite ELSE $WhiteOnBlack]; }; Button2: Controls.ClickProc ~ { outerData: Controls.OuterData _ NARROW[clientData]; programData: ProgramData _ NARROW[outerData.data]; SELECT programData.button2Nat FROM 0 => Controls.EntryReLabel[outerData, "State 0", "State 1"]; 1 => Controls.EntryReLabel[outerData, "State 1", "State 2"]; 2 => Controls.EntryReLabel[outerData, "State 2", "State 3"]; 3 => Controls.EntryReLabel[outerData, "State 3", "State 0"]; ENDCASE; programData.button2Nat _ (programData.button2Nat+1) MOD 4; }; Button3: Controls.ClickProc ~ { reply: Rope.ROPE; outerData: Controls.OuterData _ NARROW[clientData]; Controls.TypeScriptWrite[outerData, "\nType something (end with CR) "]; reply _ Controls.TypeScriptRead[outerData]; Controls.TypeScriptWrite[outerData, Rope.Concat["\nThe reply was ", reply]]; }; Button4: Controls.ClickProc ~ { outerData: Controls.OuterData _ NARROW[clientData]; IO.PutF[outerData.cmdOut, "This is a help message\n"]; }; Commander.Register["///Commands/TestControls", TestControls, "\nTest ControlsImpl.mesa."]; END. †TestControlsImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, April 30, 1986 11:13:55 am PDT ʉ˜šœ™Jšœ Ïmœ1™