0

how to send zk keyEvent

asked 2013-09-09 15:56:32 +0800

maradolla gravatar image maradolla
3

updated 2013-09-09 16:24:32 +0800

Hi,

I want to construct and send the zk keyEvent in my application, actually i am trying to provide a button for full screen mode, i am using 'F11' key. from the keyboard it's working fine. i want to provide button interface also. can you please help me on this.

here is the code i am trying. it's not working, giving some zk error like zk event not constructed correctly.

<z:button onclick="sendEvent(new zk.Event(KeyEvent('F10', self, 121, false, false, false))) "/>

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-09-10 09:23:22 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2013-09-10 09:24:26 +0800

Hi,

I am not sure if you can really fire the F11 Key from JS, and to go to full screen there is no need to send a KeyEvent to the server. It is better to listen to an event on the server side using the MVC pattern or use a command binding (MVVM pattern).

So based on this stack overflow question I created a small example showing how to go into full screen if the browser supports it, on the client side and executing some code on the server side triggered by the same event. I left out the IE Active X support... to keep it shorter.

<zk>
    <script>
        function goFullScreen() {
            var el = document.documentElement,
                rfs = // for newer Webkit and Firefox
                    el.requestFullScreen
                    || el.webkitRequestFullScreen
                    || el.mozRequestFullScreen
                    || el.msRequestFullScreen;

            if(typeof rfs!="undefined" &amp;&amp; rfs){
                rfs.call(el);
            }
        }

    </script>

    <window border="normal" title="Go Fullscreen" xmlns:w="client" height="100%">
        <button w:onClick="goFullScreen();" onClick='System.out.println("something on the server, should be a listener or command binding");' label="go fullscreen"/>
    </window>
</zk>

Robert

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: 2013-09-09 15:56:32 +0800

Seen: 25 times

Last updated: Sep 10 '13

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