Use the SearchCtrl for the filter. Make the accelerator table usable
again for testing. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44208 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1208,9 +1208,9 @@ class wxPythonDemo(wx.Frame):
|
|||||||
wx.ITEM_CHECK)
|
wx.ITEM_CHECK)
|
||||||
self.Bind(wx.EVT_MENU, self.OnToggleRedirect, item)
|
self.Bind(wx.EVT_MENU, self.OnToggleRedirect, item)
|
||||||
|
|
||||||
item = menu.Append(-1, 'E&xit\tAlt-X', 'Get the heck outta here!')
|
exitItem = menu.Append(-1, 'E&xit\tAlt-X', 'Get the heck outta here!')
|
||||||
self.Bind(wx.EVT_MENU, self.OnFileExit, item)
|
self.Bind(wx.EVT_MENU, self.OnFileExit, exitItem)
|
||||||
wx.App.SetMacExitMenuItemId(item.GetId())
|
wx.App.SetMacExitMenuItemId(exitItem.GetId())
|
||||||
self.mainmenu.Append(menu, '&File')
|
self.mainmenu.Append(menu, '&File')
|
||||||
|
|
||||||
# Make a Demo menu
|
# Make a Demo menu
|
||||||
@@ -1251,13 +1251,14 @@ class wxPythonDemo(wx.Frame):
|
|||||||
self.finddata = wx.FindReplaceData()
|
self.finddata = wx.FindReplaceData()
|
||||||
self.finddata.SetFlags(wx.FR_DOWN)
|
self.finddata.SetFlags(wx.FR_DOWN)
|
||||||
|
|
||||||
if 0:
|
if False:
|
||||||
# This is another way to set Accelerators, in addition to
|
# This is another way to set Accelerators, in addition to
|
||||||
# using the '\t<key>' syntax in the menu items.
|
# using the '\t<key>' syntax in the menu items.
|
||||||
aTable = wx.AcceleratorTable([(wx.ACCEL_ALT, ord('X'), exitID),
|
aTable = wx.AcceleratorTable([(wx.ACCEL_ALT, ord('X'), exitItem.GetId()),
|
||||||
(wx.ACCEL_CTRL, ord('H'), helpID),
|
(wx.ACCEL_CTRL, ord('H'), helpItem.GetId()),
|
||||||
(wx.ACCEL_CTRL, ord('F'), findID),
|
(wx.ACCEL_CTRL, ord('F'), findItem.GetId()),
|
||||||
(wx.ACCEL_NORMAL, WXK_F3, findnextID)
|
(wx.ACCEL_NORMAL, wx.WXK_F3, findnextItem.GetId()),
|
||||||
|
(wx.ACCEL_NORMAL, wx.WXK_F9, shellItem.GetId()),
|
||||||
])
|
])
|
||||||
self.SetAcceleratorTable(aTable)
|
self.SetAcceleratorTable(aTable)
|
||||||
|
|
||||||
@@ -1266,8 +1267,11 @@ class wxPythonDemo(wx.Frame):
|
|||||||
tID = wx.NewId()
|
tID = wx.NewId()
|
||||||
leftPanel = wx.Panel(splitter)
|
leftPanel = wx.Panel(splitter)
|
||||||
|
|
||||||
self.filter = wx.TextCtrl(leftPanel)
|
self.filter = wx.SearchCtrl(leftPanel)
|
||||||
|
self.filter.ShowCancelButton(True)
|
||||||
self.filter.Bind(wx.EVT_TEXT, self.RecreateTree)
|
self.filter.Bind(wx.EVT_TEXT, self.RecreateTree)
|
||||||
|
self.filter.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN,
|
||||||
|
lambda e: self.filter.SetValue(''))
|
||||||
|
|
||||||
self.treeMap = {}
|
self.treeMap = {}
|
||||||
self.tree = wx.TreeCtrl(leftPanel, tID, style =
|
self.tree = wx.TreeCtrl(leftPanel, tID, style =
|
||||||
@@ -1384,7 +1388,8 @@ class wxPythonDemo(wx.Frame):
|
|||||||
self.tree.Expand(self.root)
|
self.tree.Expand(self.root)
|
||||||
if firstChild:
|
if firstChild:
|
||||||
self.tree.Expand(firstChild)
|
self.tree.Expand(firstChild)
|
||||||
|
if filter:
|
||||||
|
self.tree.ExpandAll()
|
||||||
|
|
||||||
def WriteText(self, text):
|
def WriteText(self, text):
|
||||||
if text[-1:] == '\n':
|
if text[-1:] == '\n':
|
||||||
|
Reference in New Issue
Block a user