X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b792147db7e5ceb5da741f5f6e27fea79944a04c..b81383bbd984f1b0aad8db92d7be069f2a23fa74:/wxPython/samples/ide/activegrid/tool/STCTextEditor.py diff --git a/wxPython/samples/ide/activegrid/tool/STCTextEditor.py b/wxPython/samples/ide/activegrid/tool/STCTextEditor.py index 8d27a19d24..113721029a 100644 --- a/wxPython/samples/ide/activegrid/tool/STCTextEditor.py +++ b/wxPython/samples/ide/activegrid/tool/STCTextEditor.py @@ -194,10 +194,15 @@ class TextView(wx.lib.docview.View): if activate and self.GetCtrl(): # In MDI mode just calling set focus doesn't work and in SDI mode using CallAfter causes an endless loop if self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI: - self.GetCtrl().SetFocus() + self.SetFocus() else: - wx.CallAfter(self.GetCtrl().SetFocus) - + wx.CallAfter(self.SetFocus) + + + def SetFocus(self): + if self.GetCtrl(): + self.GetCtrl().SetFocus() + def OnClose(self, deleteWindow = True): if not wx.lib.docview.View.OnClose(self, deleteWindow):