0

ZK Timer OnTimer Event Listener is not working

asked 2017-06-07 11:20:48 +0800

laxmikantm gravatar image laxmikantm
1 1

I am using zk-7.0.2, when I used the following tag in zul file and then created an event listener in the listener for the onTimer event then it is getting invoked.

<timer id="timer" delay="1000" repeats="true" />

But when I used following code in listener then the event attached to the timer is not getting invoked.

Timer timer = new Timer();
    timer.setRepeats(true);
    timer.setDelay(2000);
    timer.addEventListener(Events.ON_TIMER, new EventListener<Event>() {

        public void onEvent(Event event) throws Exception {
            Messagebox.show("hello");
        }
    });

Does anyone know why it is happening? Thanks in advance.

delete flag offensive retag edit

Comments

1

timer.start() also I tried but it is not working. Actually, when I am creating a new instance of Timer at the same time it is showing that timer is running what it means? I checked that what is the status of the timer after the creation of new instance by using following code: timer.isRunning();

laxmikantm ( 2017-06-07 14:12:52 +0800 )edit

Thank you @hawk, I forgot to append timer to parent.

laxmikantm ( 2017-06-08 04:59:12 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-06-08 03:06:45 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

I don't see you attach the Timer to the page or set its parent like parentComponent.appendChild(timer). Please confirm that you have done that.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2017-06-07 11:20:48 +0800

Seen: 30 times

Last updated: Jun 08 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More