Duplicate A Container Control

It wouldn’t even have to use NSNotificationCenter on OSX since that would involve some interesting method swizzling and dynamic subclass creation like in MacOSLib. If you are uncomfortable with Cocoa declares at all, you probably shouldn’t use NSNotificationCenter. If you write an xplat solution in pure xojo it will work on all platforms anyway…

[quote=143814:@Oliver Scott-Brown]So you mean I should write something that is cross platform. So I write a class that uses the Notification Centre for OS X and mimics it for other platforms?
[/quote]

Why don’t you search for “Observer” ? About 30 threads discuss the topic…

I don’t have access to the article either but I’ve used the OS X NSNotificationCenter (without swizzling or dangerous shenanigans). What I understand the Notification Center pattern to be is what I first heard about on the old forums as an ‘Event Bus’ (but it can go by other names).

http://forums.realsoftware.com/viewtopic.php?f=1&t=35839

Searching ‘Event Bus Pattern’ finds many examples with various behaviors. It’s a very flexible idea. I cursorily looked at these links but they had good overview descriptions.

https://code.google.com/p/guava-libraries/wiki/EventBusExplained
https://code.google.com/p/simpleeventbus/
http://www.dossier-andreas.net/software_architecture/eventbus.html
http://en.wikipedia.org/wiki/Publish–subscribe_pattern

http://stackoverflow.com/questions/3987391/why-people-use-message-event-buses-in-their-code

OK. So I ponied up and bought the XDev issue for $10.00. Saved me a lot of grief. Sam’s article is quite good and I was able to basically copy his code out of the article and create the NotificationCenter myself quite easily. He does some very clever things. And yes, it is cross platform. It’s pure Xojo code - nothing at all platform dependent.

This article was well worth the money it cost me to purchase the issue. In fact, it’s making me think about re-subscribing to XDev Mag. If there’s other code in it that is as useful, then it’s a bargain. One thing I decided long ago was that it’s easier to use someone else’s code than re-invent the wheel yourself!

Notice that this is NOT what I think of as OS X’s notification center where you see nice little notifications about your app popping up on the screen. No, this is all internal to your code. And it works quite well as long as you add code to avoid endless loops of messages sent back and forth between multiple instances of the same control!

And Oliver - yes, it’s FREE. But the magazine issue is not.