mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 01:30:07 +01:00
Fix CheckListBox GetSelections()
This commit is contained in:
@@ -41,6 +41,15 @@ def run():
|
||||
c.find('Create').findOverload('wxString choices').ignore()
|
||||
c.find('Create').findOverload('wxArrayString').find('choices').default = 'wxArrayString()'
|
||||
|
||||
c.addCppMethod('wxArrayInt*', 'GetSelections', '()',
|
||||
isConst=True, factory=True,
|
||||
doc="Returns a list of the indices of the currently selected items.",
|
||||
body="""\
|
||||
wxArrayInt* array = new wxArrayInt;
|
||||
self->GetSelections(*array);
|
||||
return array;
|
||||
""")
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,16 @@ class CheckListBoxTests(wtc.WidgetTestCase):
|
||||
c.CheckedStrings = ['three']
|
||||
self.assertTrue(set(c.GetCheckedItems()) == set([2]))
|
||||
|
||||
def test_GetSelections(self):
|
||||
c = wx.CheckListBox(
|
||||
self.frame,
|
||||
choices="one two three four".split(),
|
||||
style=wx.LB_EXTENDED,
|
||||
)
|
||||
self.assertEqual(c.GetSelections(), [])
|
||||
c.SetSelection(2)
|
||||
self.assertEqual(c.GetSelections(), [2])
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user