There is an interesting question that often comes up often when writing components. How do my components communicate with each other in a way that doesn't bind them together explicitly. How does a child component call a method on a parent component without explicitly knowing who the parent is.
Knowing who the parent is prevents the component from being re-used in other contexts with different parents. There is a general solution to this whole class of problems and it was solved quite elegantly by Vassili Bykov with his Announcements framework.
The basic idea is to setup an announcer somewhere global, in the session for example.
MySession>>announcer ^ announcer ifNil: [announcer := Announcer new]
Then subclass Announcement for any interesting thing that might happen like removing a child.
Announcement subclass: #RemoveChild instanceVariableNames: 'child' RemoveChild class>>child: aChild ^self new child: aChild; yourself RemoveChild>>child: anChild child := anChild RemoveChild>>child ^child
Any component interested in this announcement registers its interest when it initializes.
Parent>>initialize super initialize. self session announcer on: RemoveChild do:[:it | self removeChild: it child] Parent>>removeChild: aChild self children remove: aChild
And any component who wants to fire this event simply announces it by sending in an instance of that custom announcement object.
Child>>removeMe self session announcer announce: (RemoveChild child: self)
Works great, and depending on where you place the announcer, you could even have different sessions sending events to each other, or different applications.
Here's a file out of a commented working demo that has a child remove itself from the parent via an announcement.
UPDATE: I use the port of Announcements from Lukas Renggli's public repository. The one on SqueakSource is a different port.