Looking for a way to implement an 'auto-complete' for combo-field%.
As the user types text into the combo-field%, the callback filters non-matching text options from the list and add faded 'tab-complete' text after the caret position. If the text-field% is cleared, restore list to original, unfiltered options.
For example:
(require racket/gui)
(define search-fields '("AB" "AA" "AC" "BC" "DZ"))
(define toplevel (new frame% [label "search"] [min-width 400] [min-height 400]))
(define combo (new combo-field%
[label ""]
[choices search-fields]
[parent toplevel]
))
(send toplevel show #t)
Typing 'A' into the text box should reduce the dropdown options to 3 : AA AB and AC.
Have looked over the documentation for combo-field% but can't find anything that would allow behavior as described. The documentation doesn't offer a way to do this but allows (send a-combo-field append l) which adds a item to the list. I want to do the opposite, restricting options as text is typed. Even the underlying popup-menu% doesn't appear to allow this.
Is there any way to do this? I have thought about deleting the popup-menu% and recreating it with new options but there doesn't seem to a way to assign it to the combo-field% afterwards.
Thanks in advance for any suggestions!