Dave Elwood wrote:I've just found that one needs an intermediary, a common ancestor. I created class Grandpa which holds both A1 and B1 and all their children and links to the children's children.
In B3 I created the listener and in A3 I created the listenerList. Then in Grandpa, in the ctor, I did :
And in A3 I didn't create any BlipListener at all !!!
meaningful names for your classes
Dave Elwood wrote:such as?
Joanne Neal wrote:Perhaps the OP's doing strange things with different sizes of paper.
Winston Gutkowski wrote:and wouldn't that other class then be a ClipListener?
I honestly don't know, because they're your classes and I couldn't really make head or tail of your question
A Class A2 object is a member of A1, constucted in the A1's constructor.
A Class A3 object is a member of A2, constucted in the A2's constructor.
A Class B2 object is a member of B1, constucted in the B1's constructor.
A Class B3 object is a member of B2, constucted in the B2's constructor.
a name that means something(tells what the program does).
Dave Elwood wrote:It demonstrates a concept
How about Grandpa <-- Son1 <-- Grandson1 <-- Greatgrandson1 etc. ?? Acceptable or no?
How can my B3 object, buried in the hierarchy of the project, gain access to the listenerList when it's part of a distant cousin? And if B3 had access to A3 (wounding encapsulation by passing "this" pointers to everyone) then why am I struggling with a custom event? If B3 had access to A3 then I'd just walk in and take the info.
Dave Elwood wrote:I've got a FrameView object at the top. In it is a SpacePanel object with all the visual goings-on. Another member of the FrameView is the Scenario class object which I am trying model as top-dog, know-it-all, Big-Brother class. The Scenario holds an array of SpaceObjects (Satellites and GravitySources) in my universe. Each Satellite holds its own Trajectory object.
And the one Scenario object holds a Hopper class which ticks off every second or so and signals all the Satellite objects to move one step further along their pre-calcuated trajectories.
Hopper (member of Scenario) generates an ActionTimer event and I want the Trajectory objects (grandchildren of Scenario) of all the Satellites to move to the next step.