Am 31.07.22 um 16:25 schrieb Torsten:
I have a ttk::combobox that is part of an optional feature in my program. When the feature is switched off, I recursively grey out all child widgets setting "state disabled".
This works fine, until I click on the combobox and then switch off the feature. I now get the following error:
bad option "state": must be activate, bbox, cget, configure, curselection, delete, get, index, insert, itemcget, itemconfigure, nearest, scan, see, selection, size, xview, or yview
The error message is from a listbox that seems to "implement" the combobox. In total, four child widgets are added:
.mycombobox.popdown
.mycombobox.popdown.f
.mycombobox.popdown.f.sb
.mycombobox.popdown.f.l
For the first three widgets I can set "state disabled". A listbox widget also has the option state, so why the error message?
I could disable only the combobox, but that would require special handling of comboboxes when recursively going over all child widgets.
.mycombobox.popdown.f is a ttk::frame and mycombobox.popdown.f.sb is a ttk::scrollbar, hence for both the associated Tcl command has the
"state" subcommand.
OTOH, .mycombobox.popdown is a toplevel and
.mycombobox.popdown.f.l is a listbox widget, hence for both the
associated Tcl command has _no_ "state" subcommand. The listbox supports
the "-state" configuration option instead, hence you can disable it via
.mycombobox.popdown.f.l configure -state disabled
Note, however, that the four descendants of the combobox are created on
demand, they won't yet exist when the widget gets created. In addition,
it is not necessary at all to disable the last three of them -- it fully suffices to disable the combobox itself via
.mycombobox state disabled
--
Csaba Nemethi
https://www.nemethi.de mailto:
[email protected]
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)