From: Robin Dunn Date: Sat, 15 Jun 2002 05:52:22 +0000 (+0000) Subject: Changed name of demo so the list sorts nicer X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6f48b1b53fe666431a45338a01da8969e9b0b258 Changed name of demo so the list sorts nicer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py index f64b5e8e07..82b0a9b9f5 100644 --- a/wxPython/demo/Main.py +++ b/wxPython/demo/Main.py @@ -66,7 +66,6 @@ _treeList = [ # core controls ('Core Windows/Controls', [ - 'VirtualListCtrl', 'wxButton', 'wxCheckBox', 'wxCheckListBox', @@ -77,6 +76,7 @@ _treeList = [ 'wxGrid', 'wxListBox', 'wxListCtrl', + 'wxListCtrl_virtual', 'wxNotebook', 'wxPopupWindow', 'wxRadioBox', diff --git a/wxPython/demo/VirtualListCtrl.py b/wxPython/demo/VirtualListCtrl.py deleted file mode 100644 index b30b4caf4c..0000000000 --- a/wxPython/demo/VirtualListCtrl.py +++ /dev/null @@ -1,84 +0,0 @@ - - -from wxPython.wx import * - -#---------------------------------------------------------------------- - -class TestVirtualList(wxListCtrl): - def __init__(self, parent, log): - wxListCtrl.__init__(self, parent, -1, - style=wxLC_REPORT|wxLC_VIRTUAL|wxLC_HRULES|wxLC_VRULES) - self.log = log - - self.InsertColumn(0, "First") - self.InsertColumn(1, "Second") - self.InsertColumn(2, "Third") - self.SetColumnWidth(0, 175) - self.SetColumnWidth(1, 175) - self.SetColumnWidth(2, 175) - - self.SetItemCount(1000000) - - self.attr1 = wxListItemAttr() - self.attr1.SetBackgroundColour("yellow") - - self.attr2 = wxListItemAttr() - self.attr2.SetBackgroundColour("light blue") - - EVT_LIST_ITEM_SELECTED(self, self.GetId(), self.OnItemSelected) - EVT_LIST_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated) - - - def OnItemSelected(self, event): - self.currentItem = event.m_itemIndex - self.log.WriteText('OnItemSelected: "%s", "%s", "%s", "%s"\n' % - (self.currentItem, - self.GetItemText(self.currentItem), - self.getColumnText(self.currentItem, 1), - self.getColumnText(self.currentItem, 2))) - - def OnItemActivated(self, event): - self.currentItem = event.m_itemIndex - self.log.WriteText("OnItemActivated: %s\n" % self.GetItemText(self.currentItem)) - - def getColumnText(self, index, col): - item = self.GetItem(index, col) - return item.GetText() - - #--------------------------------------------------- - # These methods are callbacks for implementing the - # "virtualness" of the list... - def OnGetItemText(self, item, col): - return "Item %d, column %d" % (item, col) - - - def OnGetItemImage(self, item): - return -1 # if used you should return the index in the ImageList - - - def OnGetItemAttr(self, item): - if item % 3 == 1: - return self.attr1 - elif item % 3 == 2: - return self.attr2 - else: - return None - - -#---------------------------------------------------------------------- - -def runTest(frame, nb, log): - win = TestVirtualList(nb, log) - return win - -#---------------------------------------------------------------------- - - - - - - - - -overview = """\ -""" diff --git a/wxPython/demo/wxEditor.py b/wxPython/demo/wxEditor.py index d3bbd08785..2ee5c23c6b 100644 --- a/wxPython/demo/wxEditor.py +++ b/wxPython/demo/wxEditor.py @@ -62,3 +62,9 @@ SetAltFuncs() method. + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) + diff --git a/wxPython/demo/wxListCtrl_virtual.py b/wxPython/demo/wxListCtrl_virtual.py new file mode 100644 index 0000000000..3e9a8fa7c1 --- /dev/null +++ b/wxPython/demo/wxListCtrl_virtual.py @@ -0,0 +1,88 @@ + +from wxPython.wx import * + +#---------------------------------------------------------------------- + +class TestVirtualList(wxListCtrl): + def __init__(self, parent, log): + wxListCtrl.__init__(self, parent, -1, + style=wxLC_REPORT|wxLC_VIRTUAL|wxLC_HRULES|wxLC_VRULES) + self.log = log + + self.InsertColumn(0, "First") + self.InsertColumn(1, "Second") + self.InsertColumn(2, "Third") + self.SetColumnWidth(0, 175) + self.SetColumnWidth(1, 175) + self.SetColumnWidth(2, 175) + + self.SetItemCount(1000000) + + self.attr1 = wxListItemAttr() + self.attr1.SetBackgroundColour("yellow") + + self.attr2 = wxListItemAttr() + self.attr2.SetBackgroundColour("light blue") + + EVT_LIST_ITEM_SELECTED(self, self.GetId(), self.OnItemSelected) + EVT_LIST_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated) + + + def OnItemSelected(self, event): + self.currentItem = event.m_itemIndex + self.log.WriteText('OnItemSelected: "%s", "%s", "%s", "%s"\n' % + (self.currentItem, + self.GetItemText(self.currentItem), + self.getColumnText(self.currentItem, 1), + self.getColumnText(self.currentItem, 2))) + + def OnItemActivated(self, event): + self.currentItem = event.m_itemIndex + self.log.WriteText("OnItemActivated: %s\n" % self.GetItemText(self.currentItem)) + + def getColumnText(self, index, col): + item = self.GetItem(index, col) + return item.GetText() + + #--------------------------------------------------- + # These methods are callbacks for implementing the + # "virtualness" of the list... + def OnGetItemText(self, item, col): + return "Item %d, column %d" % (item, col) + + + def OnGetItemImage(self, item): + return -1 # if used you should return the index in the ImageList + + + def OnGetItemAttr(self, item): + if item % 3 == 1: + return self.attr1 + elif item % 3 == 2: + return self.attr2 + else: + return None + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = TestVirtualList(nb, log) + return win + +#---------------------------------------------------------------------- + + + + + +overview = """\ +""" + + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) +