def OnKeyDown(self, event):
""" Do some work when the user press on the keys:
up and down: move the cursor
"""
keycode = event.GetKeyCode()
if keycode in [wx.WXK_DOWN, wx.WXK_UP]:
self.PopupListBox()
if keycode == wx.WXK_DOWN:
self.listbox.MoveSelection(1)
else:
self.listbox.MoveSelection(-1)
elif keycode in [wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_RETURN] and self.listbox is not None:
selected = self.listbox.GetSelection()
if selected != "":
self.SetValueFromSelected(selected)
else:
event.Skip()
elif event.GetKeyCode() == wx.WXK_ESCAPE:
self.DismissListBox()
else:
event.Skip()
评论列表
文章目录