realbasic-nug
[Top] [All Lists]

Re: Timer by Code?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Timer by Code?
From: Frank Condello <developer at chaoticbox dot com>
Date: Thu, 31 May 2007 03:21:29 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <d2e2da307c84eba068f56e7a62d79194 at proaxis dot com> <2D884F6B-2C2E-439B-A282-FCE98D64928E at chaoticbox dot com> <5785E78E-8BD0-4D06-BC8C-1B805637E75A at austin-home dot com>
On 31-May-07, at 2:25 AM, Glenn L. Austin wrote:

> On May 30, 2007, at 11:17 PM, Frank Condello wrote:
>
>> On 31-May-07, at 2:01 AM, Jim Wagner wrote:
>>
>>> Help,. I seem to be stuck!
>>>
>>> When you add a timer to a class in code by using the new operator,
>>> how
>>> to you access the timer's action event?
>>
>> Create a Timer subclass that implements the event, then create an
>> instance of that subclass.
>
> What I did was create the Timer subclass that took a TimerHandler as
> a handler with a method that took the timer as a parameter, in the
> Timer subclass' action it calls the TimerHandler's handler method
> with the instance as a parameter, then defined TimerHandler as a
> class interface, then defined the class with a TimerHandler interface.
>
> I know, a lot of work, but it made it easy to create timers in code
> then handle them in the defining class simply by handling the
> TimerHandler's method.

Well, better than waiting for this:
<http://www.realsoftware.com/feedback/nyadonvu>
I guess ;) Though I suppose your workaround might not work out so  
well if you need the owning class to handle a bunch of different  
timer events. I mulled over a similar problem a while back when  
porting C code that used structs with function pointers - eventually  
I just gave in and started subclassing, it's the "RB way".

Frank.
<http://developer.chaoticbox.com/>



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>