Call wxWindow_FindFocus() first, to get a window object. Then use that
object to call SetSelection:
wnd = wxWindow_FindFocus()
if wnd != None:
wnd.SetSelection(...)
···
-----Original Message-----
From: Hugo van der Merwe [mailto:s13361562@bach.sun.ac.za]
Sent: Saturday, January 26, 2002 3:13 PM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Where to call wxTextCtrl.SetSelection... ?
Sorry, I just assumed you had one handler per control. Since you can't in
your situation, here is one possibility: in your SetFocus handler, call
FindFocus (a static wxWindow method, so call like this:
wxWindow_FindFocus()
). FindFocus will return the control that has the focus. Then do whatever
you need for that control.
Hmm, another question, how do I call SetSelection on the return type of
wxWindow_FindFocus? I tried:
wxTextCtrl.SetSelection(wxWindow_FindFocus(), -1, -1)
but it wasn't too happy about that:
TypeError: unbound method SetSelection() must be called with instance as
first argument
wxWindow_FindFocus returns e.g.
<C wxWindow instance at _8247680_wxWindow_p>
So how can I "type-cast" this thing? (Can I type-cast this thing?)
Thanks,
Hugo
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users