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.
EdName = new wxTextCtrl(TabContacts, wxID_ANY, wxEmptyString, wxPoint(190,45), wxSize(300,30));
EdName->SetMaxLength(250);
EdName->SetHint("Name");
Then I click a button to clear the wxTextCtrl with the command below, but by doing that, the Hints disappear completely.
And I thought that if the wxTextCtrl no longer has text, the hints would be shown!
ONEEYEMAN wrote: ↑Mon May 04, 2020 12:05 am
Hi,
What if you start the program, go to the text control type something and then backspace the text?
Will it show then?
Thank you.
I created an example with 4 TextCtrl to test! Then after your answer I discovered that: When executing the command
He erases all the hints. But if I navigate the TAB between the controls the Hints are restored.
Is there any way I can restore those hints without having to get in and out of control? Like a general Refresh for all TextCtrl?
Because there are TextCtrl in other wxNotebook tabs, there are 4 tabs in total!
Sets a hint shown in an empty unfocused text control.
So the answer is "NO". Control shuoldn't have a focus in order to display the hint.
Actually, on Win10 the hint is still displayed in the focused control and disappears only when I type something and reappears when I delete all the text. Can be seen e.g. here
PB wrote: ↑Mon May 04, 2020 3:40 pm
Actually, on Win10 the hint is still displayed in the focused control and disappears only when I type something and reappears when I delete all the text. Can be seen e.g. here
Interestingly for me, your example has the same effect that I reported earlier. If I write, and use the clear button, it erases TextCtrl but the tip is not shown! It is only displayed if I enter TextCtrl and exit it again. Or of course if I write inside of it, and inside of it I delete the text myself and get out of it!
I can see differences even between Win7 and Win10.
Win7 (probably the same as observed by Nick):
1. The hint is shown only when the control does not have focus.
2. If I clear the control programmatically, the hint is not shown but appears if the control gets and loses focus.
Win10
1. The hint is always shown, regardless of focus.
2. If I clear the control programmatically, the hint appears.
I noticed that if I have a TextCtrl with the blue Text or any other color.
If by any chance I send him a text with the same text that exists configured in Hint, the text turns grey and not blue
I understood that because I send texts to TextCtrl from a Struct. And whenever the text from Struct is the same as Hint, TextCtrl keeps the gray color of Hint texts. Instead of using the pre-configured blue color. Do you realize that yet?
The Color only returns to normal blue, if I in this same field modify the text, or if I have any event that rewrites the text