Using dropdown ComboBox

Help
2013-03-14
2013-03-19
  • Chuck Elliot
    Chuck Elliot
    2013-03-14

    I would like to use the ComboBox as a dropdown "ListBox" that limits the selection to the items that are in the scrolledlist_items and doesn't allow typing in the entryfield. I have found the ways to disable the entry field which does this, but it greys out the field which to me implies that the entire widget is disabled. Is there a way to do this?

    This may be a stupid question to someone with more experience, but I have been trying for several days and can't find a way to do it?

     
    • Greg McFarlane
      Greg McFarlane
      2013-03-19

      Hi Chuck,

      Would an OptionMenu be suitable in this case? If you have lots of
      items then maybe not :(

      How about before you disable the entryfield you fetch the foreground
      and background colours of the normal state and set the disabled
      colours to these. Then it won't look like it is disabled.

      You will need to do a bit of research to find out which colours you
      should set. The entry has lots of colours for different states:
      background
      foreground
      highlightbackground
      highlightcolor
      insertbackground
      readonlybackground
      selectbackground
      selectforeground
      disabledbackground
      disabledforeground

      I note there is a readonlybackground. Perhaps you could set the entry
      to be in readonly state instead of disabling it?

      Veganly yours,

      Greg

      On Thu 14 Mar 2013 at 03:51:24PM +0000, Chuck Elliot wrote:

      I would like to use the ComboBox as a dropdown "ListBox" that limits
      the selection to the items that are in the scrolledlist_items and
      doesn't allow typing in the entryfield. I have found the ways to
      disable the entry field which does this, but it greys out the field
      which to me implies that the entire widget is disabled. Is there a
      way to do this?

      This may be a stupid question to someone with more experience, but I
      have been trying for several days and can't find a way to do it?


      Using dropdown ComboBox


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/pmw/discussion/33675/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/prefs/

      --
      Greg McFarlane "Life is what happens to you while you're busy making other plans." - John Lennon

       
  • Chuck Elliot
    Chuck Elliot
    2013-03-19

    Thank you so much!!!!

    Adding myCombobox.component('entry').config(state="readonly",readonlybackground = 'white')

    Does exactly what I want!

    I could have used the OptionMenu, but prefer the look of a entryfield disabled combobox!

    I'm going to sub-class it as a ListBox.

     
    Last edit: Chuck Elliot 2013-03-19