I am trying to extend the behavior of ttk :: combobox to make it behave like a Google search box in my browser - that is, I would like it to automatically fall and restrict the entries in the list so that those that match the line I typed so far since Ultimately, I would like to select the part of the line that was autocompleted, so that the next character that the user enters will delete it and restart the matching process.
I found the page in the Tcler wiki , but it seems like selecting an entry with an entered letter, which is not what I want. (Think about what the user selects from the list of US states. When they type A, I want the selection limited to Alabama, Alaska, Arizona and Arkansas, and when they type L, the list should be limited to Alabama and Alaska. Code on the wiki will select Alabama when the user types A and then Louisiana when they type L.)
I tried to define some bindings on ttk :: combobox, but gave it - to be honest, I canβt remember why - and tried to extend the behavior of the ttk :: entry to cover it.
After borrowing from ttk / combobox.tcl, I was able to publish the list and restrict the entries in the list, but now I have big problems when I added the bindings so that the up and down arrows change the selection. To be precise, the selected item moves with pleasure, but while the input widget loses focus, the whole application freezes and my tclsh absorbs the entire processor.
I am developing ActiveTcl 8.6 for both Windows and Linux, and it seems to work the same on both platforms, although I have not tried Linux since I first saw that it does not hang on Windows. I would be very happy to share my code, but since the demo version of the script works up to about 450 lines, I would not read it myself if someone else posted this a lot.
Can someone help by asking the right question to light a bulb for me? The problem is with the synchronization problem, but I donβt know where to start tracking it.
Thank you very much.
Change I had a brain, and I think the reason I gave up trying to extend ttk :: combobx was because there really were already a lot of bindings, and some things that I didn't want. The current effort uses the validate command for the input and binding widget Key-Up, Key-Down, FocusIn, and FocusOut.
The current code is on pastebin here .