[英]Pharo: how to open a Transcript if none is open
I would like to know whether a Transcript window is visible, and if not to open one. 我想知道“抄本”窗口是否可见,如果不能打开。
Since the model behind a Transcript is a PluggableTextMorph I thought about collecting all those which represent Transcripts with 由于笔录背后的模型是PluggableTextMorph,因此我考虑收集所有代表笔录的内容
PluggableTextMorph allInstances select: [ :e| PluggableTextMorph allInstances选择:[:e | e model = Transcript ] e模型=成绩单]
This is all nice, returns a bunch of objects. 一切都很好,返回了一堆对象。 However, it's not clear which of these is visible. 但是,尚不清楚其中哪些可见。 Probably a beginner Morphic question... :) 可能是初学者的Morphic问题... :)
Maybe there is a better way, but you can definitely use this: 也许有更好的方法,但是您绝对可以使用以下方法:
World submorphs
detect: [ :m | m model = Transcript ]
ifNone: [ Transcript open ]
or 要么
SystemWindow allInstances detect: [ :m | SystemWindow allInstances检测到:[:m | m model = Transcript ] ifNone: [ Transcript open ] m模型=成绩单] ifNone:[成绩单打开]
The thing is that I've tried to do 事情是我试图做
ThreadSafeTranscriptPluggableTextMorph allInstances detect: ...
but for some reason morph is still alive even if window is closed 但是由于某种原因,即使关闭了窗口,变形仍然有效
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.