On 31/07/2022 16:25, Torsten wrote:
> 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?
>
A listbox has a "state" option, but not a "state" subcommand. You seem
to be doing [.mycombobox.popdown.f.l state disabled], which is not valid
for a listbox. Instead you should be using [.mycombobox.popdown.f.l
configure -state disabled].
This is true for other tk (i.e. non-ttk) widgets too. So your procedure
that recursively goes over all widgets should be checking the type of
widget to know how to properly disable it, and if that's even possible
(you cant disable a tk::frame, for example). Without that step, the proc
will fail on any tk widget.
The type of the widget can be queried with [winfo class
mycombobox.popdown.f.l], which returns the normal value for a tk
listbox: Listbox.
Schelte.