0

onClick and OnDoubleClick in a single Component

asked 2015-06-09 13:39:56 +0800

MarioVitale gravatar image MarioVitale
1 1

How i can use onClickEvent and onDoubleClickEvent at the same time in a Window??

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-10 09:39:22 +0800

Darksu gravatar image Darksu
1991 1 4

Hello MarioVitale,

You could use the following script:

<zk xmlns:w="http://www.zkoss.org/2005/zk/client">

  <window border="normal" title="hello" id="mainWindow">


  </window>

    <script type="text/javascript">

        zk.afterMount(function() {

            jq("$mainWindow").click(function(e) {
                    var that = this;
                    setTimeout(function() {
                    var double = parseInt($(that).data('double'), 10);
                    if (double > 0) {
                        $(that).data('double', double-1);
                        return false;
                    } else {
                        alert("click");
                    }
                  }, 300);
              }).dblclick(function(e) {
                  $(this).data('double', 2);
                  alert("double click");
                  e.stopPropagation();    
              });

        });
    </script>
</zk>

Hope it helps.

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2015-06-11 04:32:03 +0800

sacredsun gravatar image sacredsun
1

You can be in executing the operation button on your data to judge, if click has been performed, the button state set is not available; or you after the click, add a label control, a message, so need not worry about this problem the. I hope to help you.

----Signature---- sacredsun lead-acid battery is my love .

link publish delete flag offensive edit
0

answered 2015-06-12 07:52:40 +0800

MarioVitale gravatar image MarioVitale
1 1

updated 2015-06-12 07:53:04 +0800

Darksu, i haven't a static id, beacuse i create a window with template. I have this situation:

<template name="children"> <window onclick="method1" ondoubleclick="method2"> </template>

Thanks

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
1 follower

RSS

Stats

Asked: 2015-06-09 13:39:56 +0800

Seen: 24 times

Last updated: Jun 12 '15

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