0

The cancel button does not work when Clicked.

asked 2016-03-01 20:16:39 +0800

Princenuk gravatar image Princenuk
29 5

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.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-03-01 23:14:37 +0800

Darksu gravatar image Darksu
1991 1 4

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

link publish delete flag offensive edit

Comments

I defined two different <window/> commands but thanks for the help.

Princenuk ( 2016-03-02 16:44:00 +0800 )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
1 follower

RSS

Stats

Asked: 2016-03-01 20:16:39 +0800

Seen: 22 times

Last updated: Mar 01 '16

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