Is there a way to get the EVT_TEXT event to trigger when a user enters a text into a wxTextCtrl object and not when wxTextCtrl ::SetLabel() is called?
The goal is for the text color to be red until the user has used the enter key at which point I need it black to show feedback the text is entered. I have accomplished this by changing it to red whenever EVT_TEXT is triggered, and black when TE_PROCESS_ENTER is triggered using wxTextCtrl ::SetForegroundColour(). But this goes wrong when I need to put put text in that same control from a database, and have that text appear in black. This this is not happening because when I call wxTextCtrl ::SetLabel() to set that text the EVT_TEXT is triggered and so the text turns red.
It did not work to call wxTextCtrl ::SetForegroundColour() after wxTextCtrl ::SetLabel().
Can the EVT_TEXT event be prevented on call to SetLabel()?
Re: Can the EVT_TEXT event be prevented on call to SetLabel()?
I may be missing something as you refer to SetLabel(), but if you want to change the value of wxTextCtrl without triggering text event, call its ChangeValue():http://docs.wxwidgets.org/trunk/classwx ... 8e763cbca1
Re: Can the EVT_TEXT event be prevented on call to SetLabel()?
wxTextEntry::ChangeValue()
If you find a difficulty.. tray use "Crooked ways" !This functions does not generate the wxEVT_TEXT event but otherwise is identical to SetValue().
Code: Select all
bool IGN_EVENT = false
...
foo(){
IGN_EVENT = true
SetLabel()..
}
OnChange(){
if (IGN_EVENT) return;
}
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.