[Newbies] Dismissing an object

Azka Niazi azka.akn at live.com
Thu Oct 3 09:24:16 UTC 2013

Thanks Ben. It was very helpful.

> Date: Thu, 3 Oct 2013 16:54:06 +0800
> From: btc at openInWorld.com
> To: beginners at lists.squeakfoundation.org
> Subject: Re: [Newbies] Dismissing an object
> Hi Azka,
>  Maybe this helps: http://wiki.squeak.org/squeak/1584
> Azka Niazi wrote:
> > When we create an instance of a class with the new method, it does not show up in the world unless we use the openInWorld method. 
> The 'World' Morphic UI interface is only a part of the system.  There 
> are many more classes dealing with non-UI facilities like file access, 
> file access, process scheduling and collections.  Should 
> "OrderedCollection new" somehow appear on the screen ?
> The #new method deals with the generic activity of creating new 
> instances only, not the additional function of asking a morph to display 
> itself in the World.
> > To make it disappear we tried dismiss me option from the halo menu. 
> By saying "tried" you imply this action failed. What gives you this 
> impression?
> > Does the dismissed object remain created somewhere in the background or does it get completely deleted from the system. 
> It depends on if anything besides the 'World' references the object. In 
> particular, if you store the instance in a variable in Workspace, that 
> will prevent it from being garbage collected. For example, copy the 
> following to a Workspace the evaluate each line one at a time.
> Smalltalk garbageCollect.    EllipseMorph allInstances inspect.  
> "Observe no instances"
> x := EllipseMorph new. "Creates a new instance"
> EllipseMorph allInstances inspect.  "Observe one instance"
> x openInWorld. "Displays the instance"
> "Close the morph using the halos"
> Smalltalk garbageCollect.    EllipseMorph allInstances inspect.    
> "Observe instance remains"
> x openInWorld.  "Re-displays same instance"
> "Close the morph using the halos"
> x := nil.   
> Smalltalk garbageCollect.    EllipseMorph allInstances inspect. "Observe 
> no instances"
> > Also, we have to ask, does evaluating (meaning repeatedly using the do it option) for the code which looks like this:className newCreate multiple objects of the same class in the background, or does it override the previously created object?
> > Azka 	
> Multiple evaluations of "SomeClassName new" creates multiple independent 
> instances of that class.
> cheers -ben
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20131003/e1e98ecf/attachment.htm

More information about the Beginners mailing list