how to develop a autocomplete listview popup

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
icryrainix
Earned a small fee
Earned a small fee
Posts: 13
Joined: Mon May 20, 2019 1:31 am

how to develop a autocomplete listview popup

Post by icryrainix » Fri May 24, 2019 3:50 am

I need a combobox with listview popup and autocomplete functions, I tested the example provided by wxwidgets library, but I can't focus the combobox while the listview is shown.

Are there any examples ? or any other suggestions?

Now I am using wxwidgets 3.1.2 under windows 10.

Thanks.

alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 317
Joined: Tue Oct 18, 2016 2:31 pm

Re: how to develop a autocomplete listview popup

Post by alys666 » Fri May 24, 2019 5:43 am

for autocomplete better to use wxListBox inserted in some wxWindow you can show/hide.
to autocomplete, you show it, fill with suggestions, and select first element.
this window "reacts" on keys Up, Down(moves selections up and down in the list), Enter(inserts selected element into your text or something, and hides), Esc(just hides autocomplete window).
In reality it does not take focus and focus must be disabled for it.
it's parent window key handler must (if autocomplete window is shown) catch Up,Down,Enter,Esc and move Autocomplete Window selector up/down, hide the window, or get current selected element and insert it somewhere.
ubuntu 16.04, wxWidgets 3.0.4

User avatar
doublemax
Moderator
Moderator
Posts: 14786
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to develop a autocomplete listview popup

Post by doublemax » Fri May 24, 2019 7:56 am

Autocomplete functionality already exists in wxWidgets, for all classes deriving from wxTextEntry (which includes wxComboBox).

Look at wxTextEntry::AutoComplete():
https://docs.wxwidgets.org/trunk/classw ... entry.html
Use the source, Luke!

Anil8753
Experienced Solver
Experienced Solver
Posts: 87
Joined: Sat Jan 16, 2016 5:57 am

Re: how to develop a autocomplete listview popup

Post by Anil8753 » Fri May 08, 2020 1:54 pm

wxTextEntry auto complete functionality is useless as it is auto complete not suggestions box. Here all the filtered results must have same string wherever is typed in text control. There is no support of custom filtering like ignore case, substring comparisons.

Post Reply