Doing something if kill focused and command text updated?

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
Tapsa
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Doing something if kill focused and command text updated?

Post by Tapsa » Fri Jan 06, 2012 10:30 am

Is there a way I can make a function happen only if the text is updated in certain text control, and its focus is lost?

I could make a workaround using global string variable, but does wxWidgets support mixing command events with focus events somehow?

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Doing something if kill focused and command text updated

Post by DavidHart » Fri Jan 06, 2012 11:48 am

Hi,
Is there a way I can make a function happen only if the text is updated in certain text control, and its focus is lost?
One way would be to catch the textctrl's wxEVT_KILL_FOCUS, then in the handler check wxTextCtrl::IsModified. If it is, do <whatever>, then use SetModified(false).
I could make a workaround using global string variable
or perhaps something safer, such as a member variable...
but does wxWidgets support mixing command events with focus events somehow?
No.

Regards,

David

Tapsa
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Doing something if kill focused and command text updated

Post by Tapsa » Fri Jan 06, 2012 11:51 am

Thanks for the reply anyway. I figured I could use wxEVT_COMMAND_TEXT_ENTER. It's actually better than what I planned.

Post Reply