TranscriptStream questions

Göran Hultgren gohu at rocketmail.com
Wed Sep 12 13:15:57 UTC 2001


Hi guys!

[SNIP]
> >You needed instead the followindg couplet:
> >
> >((myTranscript _ TranscriptStream new) openAsMorphLabel: 'My 
> >Transcript') openInWorld.

Key to understanding this is to realize that #openInWorld gets sent to the result returned by
#openAsMorphLabel: and not your stream.

> >myTranscript show: 'my text'. "works just fine"
> 
> Aha! THX! This stuff is great.
> I'm attempting to build a debug tool in Squeak in an environment 
> where we are working on an embedded application in C. Although I've 
> been following the Squeak list for some time, this is more or less my 
> first serious attempt at a useful application. I hope to show the 
> power of Squeak.
> 
> In attempting to understand what's going on, I tried the following:
> myTranscript _ TranscriptStream new.
> myTranscript openAsMorphLabel: 'My Transcript'.
> myTranscript openInWorld. "This gets a message not understood - openInWorld"

Ok, lets rewrite this with a local variable to make it clear:

| aWindow |
myTranscript _ TrnascriptStream new.
aWindow _ myTranscript  openAsMorphLabel: 'My Transcript'.
aWindow openInWorld

> What's getting the openInWorld message in the working version? It 
> seems it is no longer myTranscript.

The window. The method #openAsMorhpLabel: returns an instance of SystemWindow with your stream as
a model, not the your stream. You can easily browse implementors of a message by selecting it and
pressing Alt-B (on Win32) which gives you 2 implementations (in my image at least) where one is in
TranscriptStream:

openAsMorphLabel: labelString 
	"Build a morph viewing this transcriptStream"
	| window |
	window _ (SystemWindow labelled: labelString) model: self.
	window addMorph: (PluggableTextMorph on: self text: nil accept: nil
			readSelection: nil menu: #codePaneMenu:shifted:)
		frame: (0 at 0 corner: 1 at 1).
	^ window

...here you see that the window is returned at the last line.

regards, Göran

=====
Göran Hultgren, goran.hultgren at bluefish.se
GSM: +46 70 3933950, http://www.bluefish.se
"Department of Redundancy department." -- ThinkGeek

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com




More information about the Squeak-dev mailing list