Hi Paul,
>One alternative to doing this would be to create a set of "behavior" classes
Thanks for jumping in again :)
You're right, that would be another option. I've already thought of that way (that's what I called Hook Objects in one of my postings in this thread). Nearly forgot that - thanks that you are bringing this in again!
What do you think about performance? Do you think that checking, if there is a hook object and if yes, passing the event along sevaral objects might affect performance more than having the code in subclasses? IMO this shouldn't have a lot of effect.
I've already seen this architecture in COMCodebook. They have an abstract hook class that has an execute() method. When you need to call the hook, you're calling THIS.oHook.Execute("RightClick"). The hook object then checks if it has a method called RightClick() and calls it, if it's there. Additionally you can configure a hook object, so that it passes the request on in the chain or not. I really liked that architecture (from the theoretical point of view), but there were people saying that this would slow down my application. I've never really tested it ...
Regards,
Armin