Is it possible to show autocomplete dropdown manually
-
- Earned a small fee
- Posts: 13
- Joined: Mon May 20, 2019 1:31 am
Is it possible to show autocomplete dropdown manually
I am trying to write a custom autocomplete combobox, for example, if I input English character "a", auto completions may be other Chinese characters without "a", I can get completion arrays, but because without "a", the auto complete dropdown doesn't show.
Then, how can I make the auto complete dropdown show manually? Or how can I write this component for this purpose.
Thanks.
Then, how can I make the auto complete dropdown show manually? Or how can I write this component for this purpose.
Thanks.
Re: Is it possible to show autocomplete dropdown manually
Why? What are you missing from wxWidgets's built-in autocomplete functionality?I am trying to write a custom autocomplete combobox
https://docs.wxwidgets.org/trunk/classw ... entry.html
Check the different wxTextEntry::AutoComplete(...) methods
Use the source, Luke!
-
- Earned a small fee
- Posts: 13
- Joined: Mon May 20, 2019 1:31 am
Re: Is it possible to show autocomplete dropdown manually
I am using built in autocomplete component, but it doesn't meet my function.
I need to display different choice that without any inputs. for example, if I input "a" in combobox, but I need to show the dropdown of Chinese characters without "a". I can get auto completions including Chinese characters by custom wxtextcomplete, but the dropdown doesn't show automatically.
I need to display different choice that without any inputs. for example, if I input "a" in combobox, but I need to show the dropdown of Chinese characters without "a". I can get auto completions including Chinese characters by custom wxtextcomplete, but the dropdown doesn't show automatically.
Re: Is it possible to show autocomplete dropdown manually
If it doesn't show automatically (which an autocomplete usually does), when exactly does it show?I can get auto completions including Chinese characters by custom wxtextcomplete, but the dropdown doesn't show automatically.
What platform are you testing on?
Use the source, Luke!
Re: Is it possible to show autocomplete dropdown manually
Hi,
Also, what locale{s} is being installed on that system? Can you successfully type Chinese words inside a regular text editor?
Thank you.
Also, what locale{s} is being installed on that system? Can you successfully type Chinese words inside a regular text editor?
Thank you.
-
- Earned a small fee
- Posts: 13
- Joined: Mon May 20, 2019 1:31 am
Re: Is it possible to show autocomplete dropdown manually
for example, if I input "z", the autocompletions are "张三" and "张四", the autocomplete dropdown will not show. But if I and "z" before autocompletions, the dropdown will show,only those autocompletions with the letter I inputted will show.doublemax wrote: ↑Fri Jun 14, 2019 4:58 amIf it doesn't show automatically (which an autocomplete usually does), when exactly does it show?I can get auto completions including Chinese characters by custom wxtextcomplete, but the dropdown doesn't show automatically.
What platform are you testing on?
I am using windows 10 and wxwidgets 3.1.2 .
-
- Earned a small fee
- Posts: 13
- Joined: Mon May 20, 2019 1:31 am
Re: Is it possible to show autocomplete dropdown manually
I am using the locales of Chinese(Simplified, China), I can type Chinese words inside a text editor or combobox. and if I input Chinese, the autocomplete function is OK.
-
- Earned a small fee
- Posts: 13
- Joined: Mon May 20, 2019 1:31 am
Re: Is it possible to show autocomplete dropdown manually
this is the code I used to test autocomplete function with Chinese.
But the result is:
Code: Select all
class MyTextCompleterSimple : public wxTextCompleterSimple
{
public:
virtual void GetCompletions(const wxString& prefix, wxArrayString& res) wxOVERRIDE
{
if (prefix.Contains("z"))
{
res.push_back("张三");
res.push_back("z张四");
res.push_back("张z五");
res.push_back("zx张六");
}
}
};
Re: Is it possible to show autocomplete dropdown manually
Hi,
I presume you want to get rid of the "z" in the auto-complete list, right?
Thank you.
I presume you want to get rid of the "z" in the auto-complete list, right?
Thank you.
-
- Earned a small fee
- Posts: 13
- Joined: Mon May 20, 2019 1:31 am
Re: Is it possible to show autocomplete dropdown manually
The documentation for wxTextCompleterSimple::GetCompletions() states
I also tried wxTextCompleter and the same applies.
All this makes sense considering how autocompletion is supposed to work. I think that at least on MSW, this is also a limitation of the native behaviour (however, it seems that on Vista+ a native control can use ACO_NOPREFIXFILTERING option of IAutoComplete2 to work around it).
Regarding the solution of your issue, I would start with looking into wxStyledTextCtrl autocompletion, i.e., whether the autocompletion of this control is similarly restrictive as that of wxTextCtrl. I have no experience with wxSTC so I have no idea if it is the case. Using wxSTC may also not be appropriate for your use case, as this control has entirely different purpose than a simple single line input.
Rolling one's own proper autocompletion may not be that simple but you may end up just doing that.
As the last desperate option and only if your application is MSW only, I would try changing wxWidgets source, adding ACO_NOPREFIXFILTERING option in the wxTextAutoCompleteData ctor.
I think this makes it quite clear that your solution cannot work.Please notice that the returned values should start with the prefix, otherwise they will be simply ignored, making adding them to the array in the first place useless.
I also tried wxTextCompleter and the same applies.
All this makes sense considering how autocompletion is supposed to work. I think that at least on MSW, this is also a limitation of the native behaviour (however, it seems that on Vista+ a native control can use ACO_NOPREFIXFILTERING option of IAutoComplete2 to work around it).
Regarding the solution of your issue, I would start with looking into wxStyledTextCtrl autocompletion, i.e., whether the autocompletion of this control is similarly restrictive as that of wxTextCtrl. I have no experience with wxSTC so I have no idea if it is the case. Using wxSTC may also not be appropriate for your use case, as this control has entirely different purpose than a simple single line input.
Rolling one's own proper autocompletion may not be that simple but you may end up just doing that.
As the last desperate option and only if your application is MSW only, I would try changing wxWidgets source, adding ACO_NOPREFIXFILTERING option in the wxTextAutoCompleteData ctor.
-
- Super wx Problem Solver
- Posts: 469
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: Is it possible to show autocomplete dropdown manually
Are you maybe asking about IME instead of autocompletion?
-
- Earned a small fee
- Posts: 13
- Joined: Mon May 20, 2019 1:31 am
Re: Is it possible to show autocomplete dropdown manually
Thank you very much for you detailed instruction, I will try wxStyledTextCtrl, or changing source code.PB wrote: ↑Tue Jun 18, 2019 7:18 am The documentation for wxTextCompleterSimple::GetCompletions() statesI think this makes it quite clear that your solution cannot work.Please notice that the returned values should start with the prefix, otherwise they will be simply ignored, making adding them to the array in the first place useless.
I also tried wxTextCompleter and the same applies.
All this makes sense considering how autocompletion is supposed to work. I think that at least on MSW, this is also a limitation of the native behaviour (however, it seems that on Vista+ a native control can use ACO_NOPREFIXFILTERING option of IAutoComplete2 to work around it).
Regarding the solution of your issue, I would start with looking into wxStyledTextCtrl autocompletion, i.e., whether the autocompletion of this control is similarly restrictive as that of wxTextCtrl. I have no experience with wxSTC so I have no idea if it is the case. Using wxSTC may also not be appropriate for your use case, as this control has entirely different purpose than a simple single line input.
Rolling one's own proper autocompletion may not be that simple but you may end up just doing that.
As the last desperate option and only if your application is MSW only, I would try changing wxWidgets source, adding ACO_NOPREFIXFILTERING option in the wxTextAutoCompleteData ctor.
Re: Is it possible to show autocomplete dropdown manually
In case you missed New Pagodi's post, make sure autocompletion is really what you want and you are not confusing it with IME:
https://en.wikipedia.org/wiki/Input_method
https://en.wikipedia.org/wiki/Input_method
Re: Is it possible to show autocomplete dropdown manually
I think the OP want the feature like in this link: Visual Assist Features: Coding Assistance - Whole Tomato Software.
When user enter: "lstb", the autocompletion shows an entry "LuaStackToBinary".
When user enter: "lstb", the autocompletion shows an entry "LuaStackToBinary".