How to know which control has the focus currently?

These sort of functions can be difficult to find because they are listed
in the documentation for the class (in this case wxWindow) but they
aren't instance members, but rather static functions associated with the
class itself. The scheme for mapping these into wxPython names is
<class>_<function> (versus <class|instance>.<method>).

The fact that this is a static function is in the documentation under
wxWindow::FindFocus but unless you know the name mapping scheme, it's
difficult to know where to find the actual wxPython name (although
find/grep on the wxPython directory often does wonders ;).

···

On Fri, 2002-12-13 at 13:25, Anders Bruun Olsen wrote:

On Fri, Dec 13, 2002 at 01:08:19PM -0800, Cliff Wells wrote:
> > In my app I have a wxPanel which contains two wxTextCtrls. I would like
> > to make a function which is called from a menu which inserts a special
> > character in the wxTextCtrl which currently has the focus, but do I see
> > which control currently has the focus?
> Haven't tested it, but I'd try this:
> control = wxWindow_FindFocus()

Thanks, that was exactly the function I was looking for! :slight_smile:

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

> Thanks, that was exactly the function I was looking for! :slight_smile:
These sort of functions can be difficult to find because they are listed
in the documentation for the class (in this case wxWindow) but they
aren't instance members, but rather static functions associated with the
class itself. The scheme for mapping these into wxPython names is
<class>_<function> (versus <class|instance>.<method>).

Ahh.. that makes it a quite a bit easier for me, thanks!

The fact that this is a static function is in the documentation under
wxWindow::FindFocus but unless you know the name mapping scheme, it's
difficult to know where to find the actual wxPython name (although
find/grep on the wxPython directory often does wonders ;).

Heh, yeah - I use the wxWindows docs extensively, but sometimes it is
difficult to find out how to do something if I don't know what name to
look after :slight_smile:

···

On Fri, Dec 13, 2002 at 01:37:10PM -0800, Cliff Wells wrote:

--
Anders
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V
PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y?
------END GEEK CODE BLOCK------
PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41