TimerEvent issue

For questions and postings not covered by the other forums
ken chiam
Posts: 18
Joined: Tue May 11, 2010 1:34 pm

TimerEvent issue

Postby ken chiam » Tue Aug 03, 2010 1:40 pm

Hi all,
i am implementing a simple timer to check the status of an object every 5 sec. I came across this post, https://forums.jadeworld.com/viewtopic. ... imer#p3565, which mentioned about timer, but i tried and cant mange to get the timer working. the following is how i implemented,

i tried to write a test code in JadeScript:
vars
reg:Register; // a object i have
begin
create reg transient;


beginClassNotification(Register, true,User_Base_Event, Response_Continuous,1);
reg.beginTimer(5000, Timer_Continuous ,1);
end;

in the Register class, i created a timerEvent method, in the method:

timerEvent(eventTag: Integer) updating;

vars

begin
if eventTag=1 then
write 'show me';
endif;
end;

i dont know where goes wrong, please advices. Thanks!

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: TimerEvent issue

Postby BeeJay » Tue Aug 03, 2010 1:57 pm

Ken,

1. The beginClassNotification is somewhat redundant in the context of timer event processing, so unless you have other reasons for having this is your code I would remove it.

2. Trying to test a timer from a JadeScript is probably not a good way to test it as your JadeScript, and therefore your application that registered the timer, will terminate before the timer has the opportunity to fire after the 5 second delay period. Try putting your timer code into say a button click on a simple test form so that your application does not terminate prior to the timer event firing.

Cheers,
BeeJay.

ken chiam
Posts: 18
Joined: Tue May 11, 2010 1:34 pm

Re: TimerEvent issue

Postby ken chiam » Tue Aug 03, 2010 2:05 pm

Hi BeeJay!
Thanks for your reply! u r the guy that i am looking for, the post u posted earlier was where i understand about timerevent. i see.. i will remove the beginnotification. Thanks for your advise! i will try it. :)

ken chiam
Posts: 18
Joined: Tue May 11, 2010 1:34 pm

Re: TimerEvent issue

Postby ken chiam » Tue Aug 03, 2010 2:09 pm

oh, its working! thanks BeeJay!

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: TimerEvent issue

Postby BeeJay » Tue Aug 03, 2010 2:13 pm

It's worth noting that depending on what you're actually trying to achieve there may be better options available to you than using a timer to check the status of an object every 5 seconds.

I was merely indicating in my reply why you were not seeing your timer events firing via a JadeScript, but are getting them when running via an application that doesn't terminate before the timer is due to fire.

Cheers,
BeeJay.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 43 guests