# HG changeset patch # User laurent # Date 1255012808 -7200 # Node ID 5f7d5d1a6f9959f8e38fbc04b6f4a3dfdc8e74cf # Parent a756b58699b82d859d85838763ab722828e60f34 Add support for leaving LocationControl when RETURN or TAB pressed diff -r a756b58699b8 -r 5f7d5d1a6f99 VariablePanel.py --- a/VariablePanel.py Thu Oct 08 16:39:08 2009 +0200 +++ b/VariablePanel.py Thu Oct 08 16:40:08 2009 +0200 @@ -880,7 +880,8 @@ # create location text control self.Location = wx.TextCtrl(id=-1, name='Location', parent=self, - pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0) + pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.TE_PROCESS_ENTER) + self.Location.Bind(wx.EVT_KEY_DOWN, self.OnLocationChar) # create browse button self.BrowseButton = wx.Button(id=-1, label='...', @@ -926,6 +927,14 @@ self.Location.SetFocus() + def OnLocationChar(self, event): + keycode = event.GetKeyCode() + if keycode == wx.WXK_RETURN or keycode == wx.WXK_TAB: + self.Parent.Parent.ProcessEvent(event) + self.Parent.Parent.SetFocus() + else: + event.Skip() + def SetInsertionPoint(self, i): self.Location.SetInsertionPoint(i) @@ -940,7 +949,10 @@ wx.grid.PyGridCellEditor.__init__(self) self.Table = table self.Controler = controler - + + def __del__(self): + self.CellControl = None + def Create(self, parent, id, evt_handler): locations = self.Controler.GetVariableLocationTree() if len(locations) > 0: