Thanks Ben. It was very helpful.
Azka

> Date: Thu, 3 Oct 2013 16:54:06 +0800
> From: [email protected]
> To: [email protected]
> 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
> [email protected]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
                                          
_______________________________________________
Beginners mailing list
[email protected]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to