demo tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -264,30 +264,37 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
|
|||||||
|
|
||||||
def OnRightClick(self, event):
|
def OnRightClick(self, event):
|
||||||
self.log.WriteText("OnRightClick %s\n" % self.list.GetItemText(self.currentItem))
|
self.log.WriteText("OnRightClick %s\n" % self.list.GetItemText(self.currentItem))
|
||||||
|
|
||||||
|
# only do this part the first time
|
||||||
|
if not hasattr(self, "popupID1"):
|
||||||
|
self.popupID1 = wxNewId()
|
||||||
|
self.popupID2 = wxNewId()
|
||||||
|
self.popupID3 = wxNewId()
|
||||||
|
self.popupID4 = wxNewId()
|
||||||
|
self.popupID5 = wxNewId()
|
||||||
|
EVT_MENU(self, self.popupID1, self.OnPopupOne)
|
||||||
|
EVT_MENU(self, self.popupID2, self.OnPopupTwo)
|
||||||
|
EVT_MENU(self, self.popupID3, self.OnPopupThree)
|
||||||
|
EVT_MENU(self, self.popupID4, self.OnPopupFour)
|
||||||
|
EVT_MENU(self, self.popupID5, self.OnPopupFive)
|
||||||
|
|
||||||
|
# make a menu
|
||||||
menu = wxMenu()
|
menu = wxMenu()
|
||||||
tPopupID1 = 0
|
|
||||||
tPopupID2 = 1
|
|
||||||
tPopupID3 = 2
|
|
||||||
tPopupID4 = 3
|
|
||||||
tPopupID5 = 5
|
|
||||||
|
|
||||||
# Show how to put an icon in the menu
|
# Show how to put an icon in the menu
|
||||||
item = wxMenuItem(menu, tPopupID1,"One")
|
item = wxMenuItem(menu, self.popupID1,"One")
|
||||||
item.SetBitmap(images.getSmilesBitmap())
|
item.SetBitmap(images.getSmilesBitmap())
|
||||||
|
|
||||||
menu.AppendItem(item)
|
menu.AppendItem(item)
|
||||||
menu.Append(tPopupID2, "Two")
|
# add some other items
|
||||||
menu.Append(tPopupID3, "ClearAll and repopulate")
|
menu.Append(self.popupID2, "Two")
|
||||||
menu.Append(tPopupID4, "DeleteAllItems")
|
menu.Append(self.popupID3, "ClearAll and repopulate")
|
||||||
menu.Append(tPopupID5, "GetItem")
|
menu.Append(self.popupID4, "DeleteAllItems")
|
||||||
EVT_MENU(self, tPopupID1, self.OnPopupOne)
|
menu.Append(self.popupID5, "GetItem")
|
||||||
EVT_MENU(self, tPopupID2, self.OnPopupTwo)
|
|
||||||
EVT_MENU(self, tPopupID3, self.OnPopupThree)
|
# Popup the menu. If an item is selected then its handler
|
||||||
EVT_MENU(self, tPopupID4, self.OnPopupFour)
|
# will be called before PopupMenu returns.
|
||||||
EVT_MENU(self, tPopupID5, self.OnPopupFive)
|
|
||||||
self.PopupMenu(menu, wxPoint(self.x, self.y))
|
self.PopupMenu(menu, wxPoint(self.x, self.y))
|
||||||
menu.Destroy()
|
menu.Destroy()
|
||||||
event.Skip()
|
|
||||||
|
|
||||||
def OnPopupOne(self, event):
|
def OnPopupOne(self, event):
|
||||||
self.log.WriteText("Popup one\n")
|
self.log.WriteText("Popup one\n")
|
||||||
|
Reference in New Issue
Block a user