v4169sgr has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks,

I am using Strawbery Perl 5.24 on a Win 7 platform with Tkx to render a GUI.

I have a similar question to SOLVED - TK: How to change color of readonly BrowseEntry, except that I am using Tkx, not Tk. I am using new_ttk__combobox and setting state to read only so the user cannot edit the options.

Currently the disabled state is grey, but I would like it to be white, to match the dialog background, to give the user the impression that the widget as a whole is still 'active'. I see no method for doing this in the documentation for the combobox widget.

I have looked at BrowseEntry and JBrowseEntry in Tk. They are excellent and would more than fulfill the requirement, but I am not aware of a way of using them in Tkx after having re-read the Tkx manual and the available tcl namespace. I have also looked at tk___optionMenu but my use of it has so far thrown up odd errors to do with re-using the name of a parent widget.

Thanks in advance for your help!

Replies are listed 'Best First'.
Re: Setting disabled background on Tkx combobox widget
by huck (Prior) on Mar 15, 2017 at 10:43 UTC

    if you can wander thu the underscores needed to do this
    http://wiki.tcl.tk/37973#pagetocfe8b22ab suggest you can do this Less globally, for your specific window (read 'widget instance', e.g. '.combo') you can use

    .combo configure -font namedfont
    and by extension thereof
    .combo configure -background color

Re: Setting disabled background on Tkx combobox widget
by huck (Prior) on Mar 15, 2017 at 10:55 UTC

      Thanks for the replies. This simple approach would not work for the widget in question. You'd need to access something like "disabledbackground" or similar, but the widget doesn't expose this.

      I had considered using the combo box out of BWidgets as that seems a lot more flexible, and doesn't sacrifice functionality for fitting in with themes. However on reflection I did not like the drop down list style at all, so in the end I've ditched the requirement for combo boxes in this context to be instantiated as read only, and have kept only two states: normal and disabled. This works for me right now as it doesn't matter too much that the user can edit the selected value and potentially make it invalid.