| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. wxEVT_KILL_FOCUS event #3778 Posted by: 2004-04-09 08:49:22 | Hi All:
Hope you guys can help me with this one, I've tried just about everything. Here's what I'm trying to do:
- I have a frame with a panel - The panel has a bunch of controls, including a textctrl object to capture "total time". - The "total time" textctrl object has a custom text validator. - There is a kill focus event handler on the text validator.
Here's the problem. Closing the application calls the event handler for the "total time" object and then closes the application. However, if I go to the task manager the "exe" is still running???
How do I prevent the event handler for "total time" from being called when the frame is closed? I'm using wxWindows 2.4.2 on Windows XP. Thanks.
Ray
// ----------- Code snippet begins ------------ class TotTimeValidator : public wxTextValidator { public: TotTimeValidator(wxString* value = NULL); TotTimeValidator(const TotTimeValidator& toCopy); virtual wxTextValidator* Clone() const; bool Validate(wxWindow* parent); bool TransferToWindow(); bool TransferFromWindow(); void TotTimeChgFocus(wxFocusEvent& event); protected: private: DECLARE_EVENT_TABLE() static long m_style; wxString* m_value; }; long TotTimeValidator::m_style = wxFILTER_INCLUDE_CHAR_LIST;
...
BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(AV_QUIT, MyFrame::OnQuit) EVT_MENU(AV_ABOUT, MyFrame::OnAbout) END_EVENT_TABLE()
BEGIN_EVENT_TABLE(TotTimeValidator, wxTextValidator) EVT_KILL_FOCUS(TotTimeValidator::TotTimeChgFocus) END_EVENT_TABLE()
...
void MyFrame::OnQuit(wxCommandEvent& event) { // TRUE is to force the frame to close Close(TRUE); }
...
TotTimeValidator m_TotTimeVal = TotTimeValidator(&m_TotTime); m_pTotTime_txt = new wxTextCtrl(this, AV_TOT_TIME_ID, "", wxDefaultPosition, wxDefaultSize, 0, m_TotTimeVal).
...
void TotTimeValidator::TotTimeChgFocus(wxFocusEvent& event) { // My validation goes here. }
// ----------- Code snippet ends ------------
| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|