Menu

#299 ttk::combobox - correct (and full) operation on Windows.

open
5
2010-10-01
2010-02-10
No

This is add-on code that I have made to make ttk::combobox function properly on Windows. This includes:

1. Entry completion while combobox is editable
2. Entry completion while combobox is readonly
3. Selection completion when the list is dropped down

When in editable mode, you can begin to type text and it will autocomplete the text as you type. When in readonly mode, pressing a key will select an item from the list that begins with that key (case insensitive). When the drop down is visible, pressing a key will select the item from that list that begins with that key (case insensitive). When the drop down is not present (readonly or editable), using your Up/Down arrow keys will cycle through the list values. Pressing Alt-Down in the edit widget (readonly or editable), the drop down list will appear. Pressing Alt-Up while the drop down list is active will update the selection and close the drop down list.

These are the actions of how the combobox functions on Windows. I am unsure of how comboboxes work on Linux and OS X.

Discussion

  • Jeremy Cowgar

    Jeremy Cowgar - 2010-09-15

    I've made some bug fixes and feature enhancements to this code. Please see my public Fossil repository located at:

    http://jeremy.cowgar.com/misctcl/index.cgi/dir?name=combobox

    The fixes include proper handling of subsequent key presses of the same letter. It now traverses the matching list and will wrap back at the top when necessary. For example, if the combo box contains Allen Steve Stacy Susie Sam Zed ... When pressing s, Steve will be selected, pressing s again will match Stacy, again Susie, again Sam, again it will loop back to Steve.

     
  • Jeremy Cowgar

    Jeremy Cowgar - 2010-09-15

    Example use

     
  • Jeremy Cowgar

    Jeremy Cowgar - 2010-09-15

    Attached the new code instead of making one go to the repo.

     
  • Jeremy Cowgar

    Jeremy Cowgar - 2010-10-01

    Combobox modifications (simply source into your program)

     
  • Jeremy Cowgar

    Jeremy Cowgar - 2010-10-01

    Subsequent key presses of the same letter now cycles through possible options while in the drop down list as well.

     
  • Donal K. Fellows

    • labels: --> 01. Bindings
    • assigned_to: nobody --> jenglish
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.