[wxPython] EVT_KILL_FOCUS and wxTextCtrl

debian/unstable python 2.1 wxGTK 2.3.0

t = wxTextCtrl(self, 1, "")
t.Connect(1, -1, wxEVT_KILL_FOCUS, self.OnKill)

def OnKill(self, event):
          print event.GetEventObject().GetValue()
  #event.Skip()

When run like this the TextCtrl doesn't get the normal lost focus actions, like getting rid of the insertion point and such. If I call an event.Skip() in OnKill it clears the insertion point and such but the OnKill gets called multiple times. Is there any way to manually clear the insertion point and other things w/o calling event.Skip(), or do I just need to make OnKill only call once via some mechanism.

TIA

···

--
Ross Brattain
netmgr@canterburycrest.org
Canterbury Crest Nursing Services
Tigard, OR

Ross Brattain wrote:

debian/unstable python 2.1 wxGTK 2.3.0

t = wxTextCtrl(self, 1, "")
t.Connect(1, -1, wxEVT_KILL_FOCUS, self.OnKill)

def OnKill(self, event):
         print event.GetEventObject().GetValue()
    #event.Skip()

When run like this the TextCtrl doesn't get the normal lost focus actions, like getting rid of the insertion point and such. If I call an event.Skip() in OnKill it clears the insertion point and such but the OnKill gets called multiple times. Is there any way to manually clear the insertion point and other things w/o calling event.Skip(), or do I just need to make OnKill only call once via some mechanism.

TIA

t.Connect(1, -1, wxEVT_SET_FOCUS, self.OnSet)

self.focuses = {}

def OnSet(self, event):
  self.focuses[event.GetId()] = 1
  event.Skip()

def OnKill(self, event):
  if self.focuses[event.GetId()]:
    self.focuses[event.GetId()] = 0
    # do whatever
    pass
  event.Skip()

Works for the most part.

···

--
Ross Brattain
netmgr@canterburycrest.org
Canterbury Crest Nursing Services
Tigard, OR