<<>> <> <> <> <> <> <> DIRECTORY BasicTime USING [GMT, Unpack, Unpacked], Convert USING [RopeFromTime], MessageWindow USING [Append, Blink, Clear], PFS USING [EnumerateForInfo, InfoProc, PathFromRope, RopeFromPath], Rope, TiogaButtons USING [AppendToButton, CreateButton, CreateViewer, GetRope, SetStyleFromRope, TiogaButton, TiogaButtonProc], ViewerClasses USING [Viewer], ViewerOps USING [OpenIcon]; PTestTiogaButtonsImpl: CEDAR PROGRAM IMPORTS BasicTime, Convert, MessageWindow, PFS, Rope, TiogaButtons, ViewerOps = BEGIN ROPE: TYPE = Rope.ROPE; FirstOne: PROC ~ { v: ViewerClasses.Viewer ¬ TiogaButtons.CreateViewer[info: [name: "First One", iconic: FALSE]]; <> b: TiogaButtons.TiogaButton ¬ TiogaButtons.CreateButton[viewer: v, rope: "DoIt", format: "center", looks: "lb", proc: DisplayButton]; <> <> <> b ¬ TiogaButtons.CreateButton[viewer: v, rope: "First", proc: DisplayButton]; b ¬ TiogaButtons.AppendToButton[button: b, rope: " "]; b ¬ TiogaButtons.AppendToButton[button: b, rope: "Second", proc: DisplayButton]; b ¬ TiogaButtons.AppendToButton[button: b, rope: " "]; b ¬ TiogaButtons.AppendToButton[button: b, rope: "Third", proc: DisplayButton]; <> <> <> b ¬ TiogaButtons.CreateButton[viewer: v, rope: ""]; b ¬ TiogaButtons.AppendToButton[button: b, rope: "First", proc: DisplayButton]; b ¬ TiogaButtons.AppendToButton[button: b, rope: " "]; b ¬ TiogaButtons.AppendToButton[button: b, rope: "Second", proc: DisplayButton]; b ¬ TiogaButtons.AppendToButton[button: b, rope: " "]; b ¬ TiogaButtons.AppendToButton[button: b, rope: "Third", proc: DisplayButton]; }; DisplayButton: TiogaButtons.TiogaButtonProc ~ { MessageWindow.Append[Rope.Cat["Button contents ", TiogaButtons.GetRope[button]], TRUE]; MessageWindow.Blink[]; }; FSButtons: PROC [fPattern: ROPE] ~ { PFSInfoProc: PFS.InfoProc ~ { <> b: TiogaButtons.TiogaButton; b ¬ TiogaButtons.CreateButton[viewer: v, rope: " ", format: "table", proc: DisplayButton]; b ¬ TiogaButtons.AppendToButton[button: b, rope: Convert.RopeFromTime[created], looks: "bs", proc: DisplayTime, clientData: NEW[MyTimeRec ¬ [created]]]; b ¬ TiogaButtons.AppendToButton[button: b, rope: "\t"]; b ¬ TiogaButtons.AppendToButton[button: b, rope: PFS.RopeFromPath[fullFName], proc: DisplayFileName]; <> <> <> <<};>> RETURN [TRUE] }; v: ViewerClasses.Viewer ¬ TiogaButtons.CreateViewer[info: [name: "FSButtons", iconic: TRUE]]; TiogaButtons.SetStyleFromRope[v, fancyTableStyle]; [] ¬ TiogaButtons.CreateButton[viewer: v, rope: "Clear", format: "Center", looks: "lb", proc: ClearMsgWindow]; [] ¬ TiogaButtons.CreateButton[viewer: v, rope: "XEROX", format: "logo"]; [] ¬ TiogaButtons.CreateButton[viewer: v, rope: ""]; PFS.EnumerateForInfo[PFS.PathFromRope[fPattern], PFSInfoProc]; ViewerOps.OpenIcon[v]; }; <> <<>> fancyTableStyle: ROPE ¬ "BeginStyle (Cedar) AttachStyle (table) \"fancy table\" { block 3 in restIndent 3 in flushLeft \".\" 8 congruent leaders tabStop } StyleRule EndStyle"; ClearMsgWindow: TiogaButtons.TiogaButtonProc ~ { <> <> MessageWindow.Clear; }; MyTime: TYPE ~ REF MyTimeRec; MyTimeRec: TYPE ~ RECORD[ time: BasicTime.GMT]; DisplayTime: TiogaButtons.TiogaButtonProc ~ { timeRef: MyTime ¬ NARROW[button.clientData]; unpacked: BasicTime.Unpacked ¬ BasicTime.Unpack[timeRef.time]; MessageWindow.Append[Rope.Concat["This file created on a ", SELECT unpacked.weekday FROM Monday => "Monday", Tuesday => "Tuesday", Wednesday => "Wednesday", Thursday => "Thursday", Friday => "Friday", Saturday => "Saturday", Sunday => "Sunday", ENDCASE => "unknown day!"], TRUE]; }; DisplayFileName: TiogaButtons.TiogaButtonProc ~ { MessageWindow.Append[Rope.Cat["File named ", TiogaButtons.GetRope[button]], TRUE]; }; TryIt: PROC = { FSButtons["/tmp/*tipC*"]; }; TryIt[]; END.