Page 1 of 1

Doing something if kill focused and command text updated?

Posted: Fri Jan 06, 2012 10:30 am
by Tapsa
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?

Re: Doing something if kill focused and command text updated

Posted: Fri Jan 06, 2012 11:48 am
by DavidHart
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

Re: Doing something if kill focused and command text updated

Posted: Fri Jan 06, 2012 11:51 am
by Tapsa
Thanks for the reply anyway. I figured I could use wxEVT_COMMAND_TEXT_ENTER. It's actually better than what I planned.