On Mar 22, 2007, at 14:49 UTC, Jayson Garrett wrote:

> I've read that timers can be created in code. Does that also mean
> that  their Action event can be defined completely in code, or is it
> always  necessary to create a subclass of Timer, define the action
> event, and  then instantiate it in code?

It's possible to hook up the Action event in code, provided that the
object you want to receive this event only needs to hear from one
action source (e.g. Timer).  The Timer implements the actionSource
interface,  just like PushButton, so you can tell either one to invoke
a PerformAction method on your own class, and you can do this
dynamically:

 
<http://support.realsoftware.com/listarchives/realbasic-nug/2006-02/msg01387.html>

Just replace "PushButton" with "Timer" in this description and you'll
be all set.

However, if you're going to have a Timer subclass anyway, you may as
well also give it some easier (and more complete) way to notify its
users when it fires.  My big gripe with PerformAction is that it
doesn't specify *what* object is calling it, so a single
actionNotificationReceiver can't perform different actions for two or
more different actionSources.  You could fix that in your own subclass.

Cheers,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

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

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

Reply via email to