Re: How to define templateTimer so the action even t includes the Index parameter?
|
Hopmann Murki |
|
5/5/2008 1:49:52 AM |
Why do you need the index though? Each time is its own instance, so it has access to all its own properties and methods. So it's not like it should have to call back into the array.
However, you could simply make the index a parameter into the class constructor, like this:
Code: Class MySpiffyTimer Private Dim mIndex as Integer
Sub Constructor( index as Integer ) mIndex = index End Sub End Class
for i as Integer = 0 to 9 timeArray( i ) = new MySpiffyTimer( i ) next i
However, I would still advise against this approach. Post Comments |
|
Re: I was trying to have an array of canvasses
|
Haseena Sabir Mohammed |
|
5/5/2008 1:53:35 AM |
Essentially what I was trying to do was to have an array of canvasses with a timer associated with each. I want each canvas to switch from an "off" image (dimmed bulb) to an &quo t;on" image (lit bulb) on its own schedule. I could put the canvas array in place on scre en in the editor and put a timer on each one, but I was hoping to build it programatically to make it easier to change in the future. Thanks for the info! If there's no other way to do it I'll try the unadvised approach. Post Comments |
|
Re: How to define templateTimer so the action even t includes the Index parameter?
|
Zouzu Gassinger |
|
5/5/2008 1:51:40 AM |
If you want to associate one object with another I suggest you do that through sub-classing. So here, sub-class a Canvas and give it a timer property and a method to set it. Give the timer a canvas(lightbulb) property so it can notify the canvas when it's run event fires.
You can also use one fast timer that always checks each light bulb if it should be on or not.
Post Comments |
|
Re: How to define templateTimer so the action even t includes the Index parameter?
|
Helena Eugine Gonsalves |
|
5/5/2008 1:51:45 AM |
Another option is a ContainerControl if you have the Professional version of REALbasic 2005. Post Comments |
|