0

It's not possible to navigate a listbox' items after receiving the focus

asked 2008-11-12 10:22:08 +0800

cvarona gravatar image cvarona
554 1 6

Hi,

I'm trying to let my users use the up/down arrow keys to progress across a listbox' items without forcing them to use the mouse in order to select one list item as a start point. At first I noticed that it was indeed possible to reach a listbox by pressing tab in order to focus it; this would manifest as the whole listitem container being surrounded by the classical focus dotted line.

It was however impossible to proceed into the listitems themselves. I tried the following:

    public void onFocus( Event pEvent ) {

        LOG.debug( "--> onFocus" );
        
        if( getItemCount() != 0 ) {
            Listitem firstItem = getItemAtIndex( 0 );
            firstItem.focus();
            firstItem.setSelected( true );
        }

        LOG.debug( "<-- onFocus" );
    }

I inserted this method within my own listbox specialization, with no results. I think this is due to the fact that, according to the developer guide, listboxes do not accept 'onFocus' events.

So I wonder whether I should post this as a feature request or somebody out there has found some alternative way to obtain this effect.

With kind regards

César Varona

delete flag offensive retag edit

4 Replies

Sort by » oldest newest

answered 2008-11-18 01:50:57 +0800

robertlee gravatar image robertlee
561

Hi César,

When I tried this myself it works:

1.tab focus into the listbox with grey dotted line.
2.press up and down key, then you are able to select the list items.

Please search "Mouseless Entry listbox" under dev guide.

link publish delete flag offensive edit

answered 2008-11-18 09:03:16 +0800

cvarona gravatar image cvarona
554 1 6

Hi Robert,

I'm afraid I've been unable to experience that behaviour; this is what I've tried, both on ie7 and ff 2.0.0.18, with no results

1. I've opened the 'zk explorer' demo and selected the 'listboxes -> live data' menu option
2. I've modified the proposed source code like this:

<window title="Live Data" border="normal">
	<zscript>
		String[] data = new String[30];
		for(int j=0; j < data.length; ++j) {
			data = "option "+j;
		}
		ListModel strset = new SimpleListModel(data);
	</zscript>
        <b ><textbox /></b>
	<listbox id="list" width="200px" rows="10" model="${strset}">
		<listhead>
			<listheader label="Load on Demend" sort="auto"/>
		</listhead>
	</listbox>
</window>

3. I've klikked on the input box I've set before the listbox and then pressed tab.
4. I've tried the keys mentioned by the 'mouseless entry listbox' section, with no results.

I think I might be missing something at a very basic level. Are you able to step into listitem navigation without resorting to the mouse in the example above?

With kind regards

César Varona

link publish delete flag offensive edit

answered 2008-11-26 03:41:52 +0800

robertlee gravatar image robertlee
561

Hi César,

This is a bug that needs to be fixed. Would you be able to post this to the Bugs list?

by the way, I tweaked your code:

<window title="Live Data" border="normal">
	<zscript><![CDATA[
		String[] data = new String[30];
		for(int j=0; j < data.length; ++j) {
			data = "option "+j;
		}
		ListModel strset = new SimpleListModel(data);
	]]></zscript>
        <textbox />
	<listbox id="list" width="200px" rows="10" model="${strset}">
		<listhead>
			<listheader label="Load on Demend" sort="auto"/>
		</listhead>
		<zscript>
		list.setSelectedItem(list.getItemAtIndex(0));
		list.focus();
		</zscript>
	</listbox>
</window>

Regards,
Robert

link publish delete flag offensive edit

answered 2008-11-26 08:03:27 +0800

cvarona gravatar image cvarona
554 1 6

Hi Rober,

thanks a lot for taking the time to take a look into this; I've submitted the bug report here.

With kind regards

César Varona

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: 2008-11-12 10:22:08 +0800

Seen: 260 times

Last updated: Nov 26 '08

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