0

How could I call the listbox's onkeydown function from bandbox?

asked 2009-05-18 14:01:27 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

Hello,

I've a bandbox with one listbox inside and I need that when the user press UP or DOWN with the bandbox focused the listbox changes the selection, just like if the listbox was focused. How could I do this?

<bandbox>
    <bandpopup>
        <listbox id="list"/>
    </bandpopup>
</bandbox>

I'm able to capture the onkeydown event on bandbox, but I couldn't pass this event to the listbox, something like this:

<bandbox action="onkeydown: #{list}.keydown(event)" ... 

Anyone knows how could I do this?

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2009-05-19 03:30:52 +0800

PeterKuo gravatar image PeterKuo
481 2

you may call listbox.SelectedIndex() in event handler of bandbox()

link publish delete flag offensive edit

answered 2009-05-19 12:40:19 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

Hi,

Yeah, but how could I capture the keys UP and DOWN from the bandbox? This is the problem.

What listener works for KeyEvent.UP and KeyEvent.DOWN?

Regards,
Felipe Cypriano

link publish delete flag offensive edit

answered 2009-05-20 00:58:21 +0800

PeterKuo gravatar image PeterKuo
481 2

please visit our wiki

http://docs.zkoss.org/wiki/Component_Events#Keystroke_Events

link publish delete flag offensive edit

answered 2009-05-20 14:09:26 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

But the onCtrlKey event only works for window component. I'll have to wrap the bandbox in a window? Is that the only way?

Regards,
Felipe Cypriano

link publish delete flag offensive edit

answered 2009-05-22 03:44:46 +0800

robbiecheng gravatar image robbiecheng
1144 2
http://robbiecheng.sys-co...

all ZK components shall support onCtrlKey event, you could register it on your bandbox directly.

/robbie

link publish delete flag offensive edit

answered 2009-05-22 11:36:17 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

Thanks for the info robbie. I said that because in the wiki it's written that only window support onCtrlKey, someone should update it.

Regards,
Felipe Cypriano

link publish delete flag offensive edit

answered 2009-05-25 02:12:02 +0800

robbiecheng gravatar image robbiecheng
1144 2
http://robbiecheng.sys-co...

updated, and thank u.

/robbie

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: 2009-05-18 14:01:27 +0800

Seen: 678 times

Last updated: May 25 '09

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