wxTextCtrl greyed out "autocorrect" text Topic is solved

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
I'mHereToBeHelped
Earned a small fee
Earned a small fee
Posts: 20
Joined: Wed Jun 01, 2022 5:49 pm

wxTextCtrl greyed out "autocorrect" text

Post by I'mHereToBeHelped »

I want to implement autocorrect on my wxTextCtrl but I don't want it to be a dropdown menu with options. Instead, I want it to have text that appears in front of the text that has already been inputted and attempt to predict what the final input is going to be. When the additional text is clicked or tab is pressed while in the wxTextCtrl then the additional text is appended to the input text, otherwise it acts like its not there. To make it clear that the additional text is not part of the input yet I want it to be grey. Example: wxWidgets

Google's search engine has this feature to except the additional text is highlighted and not grey.

I don't need help with predicting the final input, just displaying the additional text.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxTextCtrl greyed out "autocorrect" text

Post by doublemax »

That may be quite difficult with a native control. You'll have to add the predicted part of the word to the text with a different style. Keep track of its position. And when the user types, you'll have to update the text and style accordingly.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxTextCtrl greyed out "autocorrect" text

Post by ONEEYEMAN »

Hi,
This is not autocorrect, but autocompletion.
Check the widgets sample - it shows how to implement it.

Thank you.
I'mHereToBeHelped
Earned a small fee
Earned a small fee
Posts: 20
Joined: Wed Jun 01, 2022 5:49 pm

Re: wxTextCtrl greyed out "autocorrect" text

Post by I'mHereToBeHelped »

Can you give me a link for the sample? Couldn't find it.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxTextCtrl greyed out "autocorrect" text

Post by ONEEYEMAN »

Hi,
What OS do you use? Did you install the library or build it yourself?
Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxTextCtrl greyed out "autocorrect" text

Post by doublemax »

The "text" sample shows how to use the spell checking of native controls (if supported by the platform), but you can not affect the dictionary or how its visualized. So i don't think that works for you.

https://docs.wxwidgets.org/trunk/classw ... 6495c43653
Use the source, Luke!
Post Reply