Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox Deselect? 1

Status
Not open for further replies.

shussai2

Programmer
Aug 28, 2003
42
CA
Hi guys,

I have a listbox setup. I have few entries in it. Now what I want to do is to deselect it. Meaning a user cannot go into the listbox and choose an entry (select the entry by pressing a button). Basically a user can just view the listbox with entries in it. Your help would be really appreciated.

Regards,

Sajjad
 
Simply set the listbox's -state to [tt]disabled[/tt], instead of its default of [tt]normal[/tt]. This prevents the user from interacting with the listbox. However, if you have the listbox connected to a scrollbar, it does not disable scrolling, which is almost always the desired behavior.

Note that setting a listbox to [tt]disabled[/tt] also prevents most programmatic changes as well. For example, the insert and delete operations have no effect on a disabled listbox. Therefore, if you want to make changes to the listbox, you'll have to set the -state to [tt]normal[/tt] first, then set it back to [tt]disabled[/tt] once you're finished.

- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
The -state option only exists in version 8.4, how can this be done in say 8.3?

I have read that you can do something like
bindtags $listbox "$listbox . all"

but how can you enable it again after that?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top