<> <> <> DIRECTORY Rope, ViewerTools, ViewerClasses, TEditOps, TextNode, Buttons, IO; ShowPosition: PROGRAM IMPORTS ViewerTools, TEditOps, TextNode, Buttons, IO = BEGIN showPositionButton: Buttons.Button _ Buttons.Create[info: [name: "Position 000000"], proc: ShowPositionButton, documentation: "Posts the position of the current input focus"]; loc: INT _ 0; ShowPositionButton: Buttons.ButtonProc = TRUSTED { IF mouseButton=blue THEN { destViewer: ViewerClasses.Viewer _ ViewerTools.GetSelectedViewer[]; stuff: Rope.ROPE _ IO.PutFR["%06d", IO.int[loc]]; IF destViewer # NIL THEN destViewer.class.notify[destViewer, LIST[stuff]]; } ELSE loc _ TextNode.LocNumber[at: TEditOps.CaretLoc[TEditOps.GetSelData[]], skipCommentNodes: TRUE] - 1; Buttons.ReLabel[NARROW[parent], IO.PutFR["Position %06d", IO.int[loc]]]; }; END.