wxWindow::FindFocus() and wxTextCtrl woes under MAC

Jason Dolan jayson.dolan at gmail.com
Tue Apr 3 06:17:04 PDT 2007


Running wxMac-2.8.3

I have a derived dialog that catches all wxEVT_CHILD_FOCUS events for
it's children.  That event is caught in a function that looks similar
to this:

MyDialog::CatchFocusEvents(wxChildFocusEvent &event)
{
   cerr << "Entering CatchFocusEvents!" << endl;
   wxWindow *pWinFocused = FindFocus();
   if(pWinFocused != NULL)
      cerr << pWinFocused->GetName()->ToAscii() << " just recieved
focus!" << endl;
}

Testing this program I find that clicking on a wxTextCtrl, the first
output ("Entering CatchFocusEvents!") prints out, but the second one
does not.  But clicking on the ListCtrl (that is also in the dialog)
will print out both outputs.  So it seems like FindFocus() cannot
determine if a textctrl currently has focus.

As a side note, this code works how I would expect it to under Windows
and Linux (both running 2.8.3).







More information about the wx-users mailing list