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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Listbox & Spinbox in Tk8.3

Status
Not open for further replies.

fabien

Technical User
Sep 25, 2001
299
0
0
AU
Hi!

1) How can I disable a listbox in Tk 8.3 since -state does not exist?

2) How can I disable Spinbox from Bwidgets (since spinbox does not exist for 8.3) ?


Note: I have to use Tcl/tk 8.3!

Many thanks!

 
I think the simplest way to disable a widget is:
Code:
    set oldscript [bind $w <KeyPress>]
    bind $w <KeyPress> { break }
Go back with:
Code:
    bind $w <KeyPress> $oldscript

You can be interested by the discussion about the text widget:
HTH

ulis
 
Thanks Ulis but I can't get this to work:

my listobox is defined as .fmtype.body.nb.f1.fsel.f.lc.list

but when I do:
set oldscript [bind .fmtype.body.nb.f1.fsel.f.lc.list <KeyPress>]
bind .fmtype.body.nb.f1.fsel.f.lc.list <KeyPress> { break }

I can still select elements from it..
 
I managed to solve the problem for the listbox by creating the following function:

proc DisableHrzListbox {} {

set lst .fmtype.body.nb.f1.fsel.f.lc.list
# disable Listbox: clear the selected item as soon as it is selected...
bind $lst <<ListboxSelect>> { .fmtype.body.nb.f1.fsel.f.lc.list selection clear 0 end}

}
}

to Enable it again I use

bind $lst <<ListboxSelect>> {}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top