[Oberon] Obtaining the name on a viewer.

peter at easthope.ca peter at easthope.ca
Fri Mar 31 02:54:56 CEST 2017


In UnixAOS Oberon this reports of name of a Text viewer and of 
a Document viewer.  Also works on Mail.Panel.  Appears it will work 
on any viewer or gadget panel.

Nevertheless it doesn't strike me as tidy.  Is there a simpler way to 
obtain the name in the general case?

Thanks,                          ... Lyall E.

MODULE Test IN Oberon;
IMPORT Oberon, Texts, TextFrames, Documents;
	
(** Test.ReportName * reports the name of a marked viewer.  
	Works for a Text viewer and for a Doc viewer. *)
PROCEDURE ReportName*; 
	VAR 
		D: Documents.Document;
		nameS: Texts.Scanner;
		W: Texts.Writer;
	BEGIN
		Texts.OpenWriter(W);
		Texts.WriteString(W, "Marked viewer is named ");
		D := Documents.MarkedDoc();
		IF D # NIL THEN
			Texts.WriteString(W, D.name)
		ELSE
			Texts.OpenScanner(nameS, Oberon.MarkedViewer().dsc(TextFrames.Frame).text, 0); 
			Texts.Scan(nameS); Texts.WriteString(W, nameS.s)
		END;
		Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
END ReportName;

BEGIN END Test.

-- 

123456789 123456789 123456789 123456789 123456789 123456789 123456789
Tel: +1 360 639 0202                      Pender Is.: +1 250 629 3757
http://easthope.ca/Peter.html              Bcc: peter at easthope. ca



More information about the Oberon mailing list