I know that in the newer Xojo versions you can define a delegate for events, but for the life of me, I cannot figure out how to do that in REALBasic 5.5. Yes, I know it is a really old version, but I’m building a native app for MacOS 9. Also, if (in code) I create a new timer instance (ie. Dim tim = new Timer), how do I then assign a handler method for the Action event? I know I can if drop a timer control on the window , but I want to dynamically instantiate the the new object in code and not necessarily add it as a control on the window.
I guess the 2 main things I’m hoping someone could answer for me would be:
-
How do you define a delegate in RB 5.5.5? Is it even possible? Or is that something that came in a later release?
-
For objects that have events defined on them (the Timer class for example), how do you programmatically assign an event handler? When instantiating the Timer class, the ‘Action’ event doesn’t even appear to be a class member when using RB’s auto-completion. But if you drag-and-drop a Timer control on to a window and then ‘Edit Code → Controls → Timer1 → Action’ you can add handler code. What I was hoping for was something like:
Dim tim As Timer = new Timer
tim.OnAction(Self.timerHandlerDelegate)
Or even what Xojo has:
tim.addActionNotificationReceiver(Self)
Where your receiver class then inherits from the ‘actionNotificationReceiver’ interface (which exists in RB 5.5.5)
Ultimately, I’d like to define custom events and then be able to wire up my own handler for those events and I can’t seem to figure out how to do that through RB’s UI, which I definitely admit could just be me just not understanding something. But I also searched though several example projects and also the language reference looking for key words like ‘event’, ‘delegate’, ‘handler’, etc.
Any help from you fine folks would be greatly appreciated!