0

Problem with event 'onCtrlKey'

asked 2010-02-17 10:57:04 +0800

softteam gravatar image softteam
45 4

updated 2013-01-31 06:53:01 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi all,

I defined the function shown below, with the intention of capturing a series of keys, but only enters the event when I press ctrl + e, does not fall for any of the other cases. (F5, Up & Down)

oInputElement.setCtrlKeys("^e#f5#up#down");                     
oInputElement.addEventListener("onCtrlKey", new org.zkoss.zk.ui.event.EventListener() {
    public void onEvent(Event event) throws Exception {
        if (((KeyEvent)event).getKeyCode() == 69){
                                      (ctrl + e)
                                  ....
        }else if (((KeyEvent)event).getKeyCode() == 40) {
                                      (dowm)
                      ....
        }else if (((KeyEvent)event).getKeyCode() == 38) {
                                      (up)
                      ....
        }else if (((KeyEvent)event).getKeyCode() == 116) {
                                      (f5)
                      ....                          
        }
    }
});

Thanks,

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-02-17 19:11:52 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi, softteam
I try this sample
it works well

<zk>
	<textbox id="tb" ctrlKeys="^e#f5#up#down">
		<attribute name="onCtrlKey"><![CDATA[
		    int keyCode = ((KeyEvent) event).getKeyCode();
			switch(keyCode){
				case 69: alert("Ctrl + e");break;
				case 40: alert("down");break;
				case 38: alert("up");break;
				case 116: alert("f5");break;
			}
		]]></attribute>
	</textbox>
</zk>

link publish delete flag offensive edit

answered 2010-02-18 10:46:21 +0800

softteam gravatar image softteam
45 4

Hi as1225,

True if it works, I have tried on a new project and works well. The problem is when I put it in another project I'm working, which only comes when ctrl + e. I tried also on another project and work correctly all but the f5, it only works for firefox. I will investigate about it.

Thank you.

link publish delete flag offensive edit

answered 2012-11-05 03:29:21 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi silicon
You can post the bug in the following url
http://tracker.zkoss.org/secure/Dashboard.jspa

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2010-02-17 10:57:04 +0800

Seen: 1,069 times

Last updated: Jan 31 '13

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