Interface class in Squeak

Tim Rowledge tim at rowledge.org
Wed Jun 8 15:35:22 UTC 2005


Jan B. Krejèí <janbkrejci at gmail.com> wrote:

> On 6/8/05, Hoang Hao <hoanghao456 at yahoo.com> wrote:
> > All of these works grant me a warning, Message not understood: GUIConstants
> > >> totalAnimatedFrames. 
> > I traced through the error and found it located in the initilization of the
> > testGUI. 
> 
> do you have an accessor method named totalAnimatedFrames? like:
> 
> totalAnimatedFrames
>     ^ totalAnimatedFrames
> 
> you can not access instance variables without a method

Whilst that is a perfectly correct statement it is not the answer Hoa needs.

To use a SharedPool subclass as a way of storing values (often constants) and
sharing them across several classes that are not directly related you need to
a) make the SharedPool subclass (GUIConstants)
b) give it the _class_ variables you need to have for your values. See for
example  BalloonEngineConstants
c) refer to the shared pool in the class definition of your class. See
BalloonEngine and look at the line 'poolDictionaries: ' in the class def.

tim
--
Tim Rowledge, tim at rowledge.org, http://www.rowledge.org/tim
Great leaders inspire by example. When that's not an option, brute intimidation
works pretty well.



More information about the Squeak-dev mailing list