[Gambas-user] How do I use tag property for a group of timers ?
Tobias Boege
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* [1]. 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.
Example attached.
Regards,
Tobi
[1] http://gambaswiki.org/wiki/doc/object-model#t23
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: override-timer-0.0.1.tar.gz
Type: application/gzip
Size: 11585 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190817/d80ca3ac/attachment.gz>
More information about the User
mailing list