ShowPosition.mesa
Michael Plass, December 15, 1982 10:38 am
Last Edited by: Ramshaw, September 24, 1983 12:41 pm
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.