multiple Transcript windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple Transcript windows

Mark Volkmann
If I have multiple Transcript windows open, can I choose in code which  
one will receive output?
If not, what is the purpose of having more than one open?

---
Mark Volkmann




_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: multiple Transcript windows

K. K. Subramaniam
On Friday 26 Sep 2008 11:31:31 pm Mark Volkmann wrote:
> If I have multiple Transcript windows open, can I choose in code which
> one will receive output?
Yes. The "window" is a SystemWindow which shows the contents of the
TranscriptStream stored in its 'model' variable. If you have an oop to a
window, say "targetWindow", then use "targetWindow model" to refer to its
TranscriptStream.

E.g.
| t hellow |
t := TranscriptStream new.
hellow := t openLabel: 'hello'.
hellow model show: 'hello world'; cr

HTH .. Subbu


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: multiple Transcript windows

David T. Lewis
In reply to this post by Mark Volkmann
On Fri, Sep 26, 2008 at 01:01:31PM -0500, Mark Volkmann wrote:
> If I have multiple Transcript windows open, can I choose in code which  
> one will receive output?
> If not, what is the purpose of having more than one open?

The Transcript is normally used as a single place to write things, such that
each open Transcript window is a view onto the same unlying transcript stream.
Thus the singleton instance is kept in a global variable, and is an instance
of TranscriptStream:

        Smalltalk at: #Transcript

To explicitly write output to different windows, you could do something
like this:

        | t1 t2 |
        t1 := TranscriptStream new.
        t1 open.
        t2 := TranscriptStream new.
        t2 open.
        t1 show: 'this is my private transcript number one'.
        t2 show: 'this is my private transcript number two'.

- Dave
 
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners