0

Listbox in mold select: impossible to select the first item without previously selecting any other

asked 2011-05-13 05:35:20 +0800

cvarona gravatar image cvarona
554 1 6

Hi there,

just try

<window title="Listbox" border="normal">
	<listbox rows="1" mold="select" id="lb">
		<listitem label="Inbox" id="Inbox" />
		<listitem label="Received" id="Received" />
		<listitem label="Draft" id="Draft" />
	</listbox>		
        <button label="Show selected item" onClick='Listitem li = lb.getSelectedItem(); alert( li == null? "No item selected" : String.valueOf( li ) );' />
</window>
in the online zksandbox.

According to my experience with ff it's impossible to get the 'Inbox' listitem selected unless I previously select 'Received' or 'Draft'. I'm not much sure as to what the philosofy of a dropdownlist should be, but perhaps the first item in the list should be the selected item by default.

With kind regards

César Varona

delete flag offensive retag edit

3 Replies

Sort by » oldest newest

answered 2011-05-13 08:04:26 +0800

cvarona gravatar image cvarona
554 1 6

Or, to put it with another words: perhaps the displayed item should always be the selected item, even if the user has not performed any gesture on the listbox.

link publish delete flag offensive edit

answered 2011-05-13 09:48:46 +0800

twiegand gravatar image twiegand
1807 3

updated 2011-05-13 09:50:25 +0800

César,

One way to deal with this is just to set the selected index at create time.  Simply change your <listbox> to look like this:

<listbox rows="1" mold="select" id="lb" onCreate="self.setSelectedIndex(0)">

Then, in your alert you can do something like this to get the actual label (e.g. Inbox):

alert(lb.getSelectedItem().getLabel());

Regards,

Todd

link publish delete flag offensive edit

answered 2011-05-13 10:01:00 +0800

cvarona gravatar image cvarona
554 1 6

Hi Todd,

thanx a lot for your tip; I think it will do.

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: 2011-05-13 05:35:20 +0800

Seen: 302 times

Last updated: May 13 '11

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