-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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))) "/>
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" && 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
Asked: 2013-09-09 15:56:32 +0800
Seen: 25 times
Last updated: Sep 10 '13
adding a menuitem with image on Menubar
can somebody give the use of imagecontent in menuitem ? [closed]
label in org.zkoss.zul.Messagebox must be middle aligned [closed]
Grid with frozen column shows unnecessary scrollbar
Component with independents columns
ZK ComboBox constraint firing on getSelectIndex()
Problems with visible/invisible grids using flex
A container should have a disable attribute.
Video inside: Processing... not translated to set org.zkoss.web.preferred.locale in zk.xml