Delegates in REALbasic
Since discovering Cocoa a while back, i've always wanted to be able to implement a delegate system within rb's limited event system without using Class Interfaces.
A delegate is a really simple concept. A delegate is an object that implements events for another object. Take the Socket class for example. Instead of always receiving the 'PageReceived' event within a subclass or whatnot, you could set a delegate on your socket object, and have that object implement the 'PageReceived' event. What's great about delegates is that they don't need to implement every event. They can choose which ones to fill. When the object that wants to call into a delegate tries to call it, it can check if the delegate implements the event. If it does, it just goes ahead and calls into it, if it does not implement the event, then it can just do something else.
I'll be glad to help anyone who wants more info about delegates. You can download the plugin below.
Download CFDelegatePlugin 0.1
A delegate is a really simple concept. A delegate is an object that implements events for another object. Take the Socket class for example. Instead of always receiving the 'PageReceived' event within a subclass or whatnot, you could set a delegate on your socket object, and have that object implement the 'PageReceived' event. What's great about delegates is that they don't need to implement every event. They can choose which ones to fill. When the object that wants to call into a delegate tries to call it, it can check if the delegate implements the event. If it does, it just goes ahead and calls into it, if it does not implement the event, then it can just do something else.
I'll be glad to help anyone who wants more info about delegates. You can download the plugin below.
Download CFDelegatePlugin 0.1
Comments
No comments yet
Add Comment