[Gambas-user] How do I use tag property for a group of timers ?
taboege at gmail.com
Sat Aug 17 13:26:00 CEST 2019
On Sat, 17 Aug 2019, Vinode Singh Ujlain wrote:
> Please see attached code
> I am having an *array* of *struct* wherein a member of struct is a timer.
> Thus I have a set of timers firing.
> Since timer object doesn't have a *tag* property , how do I figure out which
> timer has fired ?
Bruce gave a good answer to resolve this in an orderly manner. That just
leaves me with the obligatory dubious answer.
You can extend the built-in Timer class and add a Tag property if you
find that you need it frequently. This works by declaring a class named
"Timer" in your project and marking it as "Export". What will happen is
that this class replaces the built-in Timer class during class loading
*using inheritance* . So as long as there are no symbol conflicts
(which there won't be as you just declare a new Tag property in your
Timer class), the composed Timer contains the features of both versions.
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 11585 bytes
Desc: not available
More information about the User