-
FEATURED COMPONENTS
First time here? Check out the FAQ!
This is my code for the cancel button on click event :
public void onClick$cancel( Event ev ) throws InterruptedException {
if ( Messagebox.show( "Leave without saving ?", "Leave?", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION ) == Messagebox.YES ){ closeWin(); } return; }
When I click the cancel button nothing happens. However, I call this function here :
if ( tabpanel != null ){ tabpanel.getLinkedTab().addEventListener( "onClose", new EventListener(){ public void onEvent( Event ev ) throws Exception { ev.stopPropagation(); onClick$cancel( ev ); }}); }
And the message shows up fine when I close a tab however ,the On click portion doesn't actually work when I actually click the cancel button.
Hello Princenuk,
Please find below a simple example:
Zul:
<zk>
<window border="normal" title="hello" apply="pkg$.TestComposer">
<div>Welcome to ZK Fiddle , run it right now!</div>
<button id="btn" label="Click"></button>
</window>
</zk>
Java:
package pkg$;
import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zk.ui.ext.*;
import org.zkoss.zk.au.*;
import org.zkoss.zk.au.out.*;
import org.zkoss.zul.*;
public class TestComposer extends GenericForwardComposer{
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
public void onClick$btn(Event e){
Messagebox.show("Hi btn");
}
}
Best Regards,
Darksu
Asked: 2016-03-01 20:16:39 +0800
Seen: 22 times
Last updated: Mar 01 '16