-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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.
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.
Asked: 2017-06-07 11:20:48 +0800
Seen: 30 times
Last updated: Jun 08 '17
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 )editThank you @hawk, I forgot to append timer to parent.
laxmikantm ( 2017-06-08 04:59:12 +0800 )edit