[Newbies] RE: How to reopen a collapsed Morph from another Morph?
Ron Teitelbaum
ron at usmedrec.com
Sat Aug 15 20:11:45 UTC 2015
> From: Fredrik Alink
> Sent: Saturday, August 15, 2015 6:22 AM
>
> Ron Teitelbaum wrote
> > Could you post more details like example code that shows the error,
> > and maybe a picture of what you are seeing?
>
> <http://forum.world.st/file/n4843032/SQ.png>
>
[Ron Teitelbaum]
Thanks that is much more clear.
Try replacing collapse with collapseOrExpand.
Then
> self mainConsole currentWorld removeMorph: (self mainConsole).
> self mainConsole openInWorld.
With self mainConsole collapseOrExpand.
I think the issue here is that the console changed from a SystemWindow to a CollapsedMorph. To close the CollapsedMorph you need to call getCollapsedFrame and close that. collapseOrExpand toggles the state between collapsed and expanded and takes care of that for you.
All the best,
Ron
> Code:
>
> *Class hierarchy:*
>
> Morph
> BaseInterface
> MainConsole
> ModelConsole
>
> *step 1:*
>
> MainConsole new
> super initialize
> ( <initialisations>
> self initScreenItemStates.
> self openWindow.
> self openInWorld.
> owner := self currentWorld)
>
> The MainConsole shows up.
>
> *Step 2:*
>
> (MainConsole) demoButtonClicked
> self
> modelConsole: ((ModelConsole new) “init as in MainConsole”
> mainConsole: self;
> yourself);
> collapse.
>
> The ModelConsole shows up, the MainConsole collapses.
>
> *Step 3:*
>
> (ModelConsole) xButtonClicked
> "close own Modelprocessor"
> self mainConsole isNil
> ifFalse: [
> "uncollapse MainConsole: remove and then reactivate"
> self mainConsole currentWorld removeMorph: (self mainConsole).
> self mainConsole openInWorld."
> "disconnect MainConsole"
> self mainConsole modelConsole: nil.
> self mainConsole: nil].
> "close ModelConsole"
> ^self currentWorld removeMorph: self
>
> The MainConsole shows up, the ModelConsole disppears, but the collapsed
> MainConsole stays visible on screen.
>
> *Step 4:*
>
> (MainConsole) exitButtonClicked
> self modelConsole isNil
> ifFalse: [self modelConsole exitButtonClickedInMainConsole].
> ^self currentWorld removeMorph: self
>
> The MainConsole disappears, but the collapsed MainConsole stays visible on
> screen. Deopending of the order you do the abov, it is still 1 time active,
> otherwise it is dead. When deaad, it just disappears from the screen when
> clicking on x, v, + or –.
>
>
>
> --
> View this message in context: http://forum.world.st/How-to-reopen-a-
> collapsed-Morph-from-another-Morph-tp4842627p4843032.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
More information about the Beginners
mailing list