0

How to disable a listbox

asked 2009-10-21 23:26:25 +0800

vdrockywang gravatar image vdrockywang
120 2 4

A listbox have many rows and user can select any row he want

when I am modifying data, how can I disable listbox, let user cannot change the current selected row

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2009-12-02 01:32:24 +0800

vdrockywang gravatar image vdrockywang
120 2 4

It real work ! :D
thank you so much.

link publish delete flag offensive edit

answered 2009-10-23 04:53:44 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-10-23 04:55:34 +0800

like baskaraninfo wrote:

	
  (not tested)

	
   List list = myListbox.getItems();
	for (Object object : list) {

              // need a casting to Listitem
	      Listitem item = (Listitem) object;

	      item.setDisabled(true);
              }

best
Stephan

link publish delete flag offensive edit

answered 2009-10-23 03:14:32 +0800

vdrockywang gravatar image vdrockywang
120 2 4

Can this problem be resolved ?

link publish delete flag offensive edit

answered 2009-10-22 03:07:33 +0800

vdrockywang gravatar image vdrockywang
120 2 4

listbox.getItems().setXXX doesn't have setDisabled() method can call.....

I don't know what you mean... you just think ??? do you sure how to resolve this problem ??

link publish delete flag offensive edit

answered 2009-10-22 00:43:59 +0800

baskaraninfo gravatar image baskaraninfo
536 2 2 9

If it didn't work, then you need to disable each and every item in the listbox manually one-by-one.

Get List.getItems() and call setDisabled(true) on each item.

I think it will solve your problem.

link publish delete flag offensive edit

answered 2009-10-22 00:38:03 +0800

vdrockywang gravatar image vdrockywang
120 2 4

updated 2009-10-22 00:39:05 +0800

No, I had try this, It didn't work !

I use Listbox.setDisabled(true). But I still can select other row...

Do you really try it and can work ???


Or this is a bug ??? because I had try to Button.setDisabled(true), I really cannot press button, It work correctly as I want.

link publish delete flag offensive edit

answered 2009-10-22 00:15:15 +0800

baskaraninfo gravatar image baskaraninfo
536 2 2 9

After getting the selected item, you can disable the listbox using the following method:

setDisabled(boolean disabled)

Then after finishing all your work, you can enable the listbox and set the selected item again, if you need.

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-10-21 23:26:25 +0800

Seen: 736 times

Last updated: Dec 02 '09

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