[Newbies] Check wheater an instance of a class is actually there
johnson at cs.uiuc.edu
Wed Dec 23 12:47:13 UTC 2009
Whenever you create MyFileLibrary, you need to store it in a
particular variable "aFileLibrary". That means you need an object
that owns the variable. Let's call the class of this object
MyApplication (since I have no idea what your application is; this is
actually a horrible name and I'm sure you can do better). This object
might be the container of the morphs.
Hans> I need this, because wenn an Instance of MyFileLibrary exists at the
Hans> checking time, I want to proceed with an other method than I want to
Hans> proceed with when an instance of MyFileLibrary does not exists.
This is probably a method of MyApplication. It checks if aFileLibrary
s nil and does the appropriate action. If it is the container of the
morphs then the morphs can just send to their container (or parent, I
forget what it is called). In general, morphs should be as decoupled
from each other as possible, so it is usually not a good idea for them
all to have varibles that reference each other. Even sending
specialized messages to their parent is a little odd, but it is a good
Of course, you have told us very little. The odds are good that there
is something simpler that would work better.
More information about the Beginners