X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7403ad2d154a8e2974fdc5fc215258f3a75cdde..ff1dadae388b2f408874b80251d64d16d9d46280:/wxPython/wx/lib/editor/editor.py diff --git a/wxPython/wx/lib/editor/editor.py b/wxPython/wx/lib/editor/editor.py index d0a67cbeef..d94a8cd8c5 100644 --- a/wxPython/wx/lib/editor/editor.py +++ b/wxPython/wx/lib/editor/editor.py @@ -483,6 +483,7 @@ class Editor(wx.ScrolledWindow): self.SelectEnd = None self.UpdateView() self.CaptureMouse() + self.SetFocus() def OnLeftUp(self, event): if not self.HasCapture(): @@ -551,12 +552,13 @@ class Editor(wx.ScrolledWindow): def AdjustScrollbars(self): - for i in range(2): - self.SetCharDimensions() - self.scroller.SetScrollbars( - self.fw, self.fh, - self.CalcMaxLineLen()+3, max(self.LinesInFile()+1, self.sh), - self.sx, self.sy) + if self: + for i in range(2): + self.SetCharDimensions() + self.scroller.SetScrollbars( + self.fw, self.fh, + self.CalcMaxLineLen()+3, max(self.LinesInFile()+1, self.sh), + self.sx, self.sy) #------------ backspace, delete, return @@ -940,7 +942,7 @@ class Editor(wx.ScrolledWindow): self.AdjustScrollbars() def OnChar(self, event): - key = event.KeyCode() + key = event.GetKeyCode() filters = [self.AltKey, self.MoveSpecialControlKey, self.ControlKey,