wxTextCtrl: how do you...

BlitzMax Forums/Brucey's Modules/wxTextCtrl: how do you...

Pete Rigz(Posted 2008) [#1]
...process an event after it's lost focus? I'd like to grab the contents of text controls after the user has finished typing and either pressed tab or clicked somewhere else. At the moment I'm just using TEXT_ENTER but it's not quite as nice as I'd like it, and the only other option is TEXT_UPDATED but I don't won't to process the contents till the value has been completely entered.

Cheers in advance!


Brucey(Posted 2008) [#2]
Hi,

I believe you want to connect to a wxEVT_COMMAND_KILL_FOCUS event (it's a wxFocusEvent type).
Actually, that should probably not be a _COMMAND_ event at all. I should change it to wxEVT_KILL_FOCUS. There's also a SET_FOCUS event.

Anyhoo. The event should be raised when focus leaves your control.


Brucey(Posted 2008) [#3]
Although confusingly, both wxEVT_KILL_FOCUS and wxEVT_COMMAND_KILL_FOCUS are defined in wxWidgets, with different ids...

Try out wxEVT_COMMAND_KILL_FOCUS and see if it works for you :-)


Pete Rigz(Posted 2008) [#4]
Ahh, I tried wxEVT_COMMAND_KILL_FOCUS and nothing happened but wxEVT_KILL_FOCUS seems to work perfectly, so that'll do me :) thanks!