def __init__(self, parent, id_, get_doc, size=wx.DefaultSize): """Initializes the LineCtrl control and its attributes. @param get_doc: callback method for retreiving a reference to the current document. """ wx.SearchCtrl.__init__(self, parent, id_, "", size=size, style=wx.TE_PROCESS_ENTER, validator=util.IntValidator(0, 65535)) # Attributes self._last = 0 self.GetDoc = get_doc # Hide the search button and text self.ShowSearchButton(False) self.ShowCancelButton(False) self.SetDescriptiveText(wx.EmptyString) # MSW/GTK HACK if wx.Platform in ['__WXGTK__', '__WXMSW__']: for child in self.GetChildren(): if isinstance(child, wx.TextCtrl): child.SetValidator(util.IntValidator(0, 65535)) child.Bind(wx.EVT_KEY_UP, self.OnKeyUp) break else: self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) # Event management self.Bind(wx.EVT_TEXT_ENTER, self.OnInput)
def __init__(self, parent, id_, get_doc, size=wx.DefaultSize): """Initializes the LineCtrl control and its attributes. @param get_doc: callback method for retrieving a reference to the current document. """ super(LineCtrl, self).__init__(parent, id_, u"", size=size, style=wx.TE_PROCESS_ENTER, validator=util.IntValidator(0, 65535)) # Attributes self._last = 0 self.GetDoc = get_doc