def __init__(self, parent, choices=None, dropDownClick=True,
element_path=None, **therest):
"""
Constructor works just like wx.TextCtrl except you can pass in a
list of choices. You can also change the choice list at any time
by calling setChoices.
"""
therest['style'] = wx.TE_PROCESS_ENTER | therest.get('style', 0)
wx.TextCtrl.__init__(self, parent, **therest)
# Some variables
self._dropDownClick = dropDownClick
self._lastinsertionpoint = None
self._hasfocus = False
self._screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
self.element_path = element_path
self.listbox = None
self.SetChoices(choices)
# gp = self
# while ( gp != None ) :
# gp.Bind ( wx.EVT_MOVE , self.onControlChanged, gp )
# gp.Bind ( wx.EVT_SIZE , self.onControlChanged, gp )
# gp = gp.GetParent()
self.Bind(wx.EVT_KILL_FOCUS, self.OnControlChanged)
self.Bind(wx.EVT_TEXT_ENTER, self.OnControlChanged)
self.Bind(wx.EVT_TEXT, self.OnEnteredText)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
# If need drop down on left click
if dropDownClick:
self.Bind(wx.EVT_LEFT_DOWN, self.OnClickToggleDown)
self.Bind(wx.EVT_LEFT_UP, self.OnClickToggleUp)
评论列表
文章目录