Multiple Selected Items in ControlList?
March 13th, 2010 by , under nnmj.com.
Thanks in advance.
Thanks for implementing this so quickly. I'll get the latest build and try it out this weekend.
So if I'm understanding correctly, I'll need to catch:
onAction(whatever)
self.list.getSelectedItem().select(True)
Then when I want to process what the selected items, I parse all the ItemList and see which ones IsSelected()
Let me know if I'm in the ballpark.
Thanks again.
It can be done, but the control itself does not support it.
I have that done, but I want to add an IsSelected() also.
Should I follow python and call it getSelected() or name it what the listitem functions is isSelected()?
Edit: I'll make it isSelected() to match.
Really there should just be a color field on ListItem.
def onAction( self, action ):
if ( action.getButtonCode() == 259 ): #Y button on controller
self.listcontrol.getSelectedItem().select( not self.listcontrol.getSelectedItem().isSelected() )
and wow, I just figured out something I should have known.
For anybody who didn't know this(maybe only me), all the set*() methods and the new select() method work instantly. I mean you don't need to getSelectedItem() change it and add it back to the list. It updates itself. I never used those before. :S
Edit: Methods added.
self.list.getSelectedItem().select(True)
is = self.list.getSelectedItem().isSelected()
So just expose a select() method?
I can do that and submit a patch.
#If you have any other info about this subject , Please add it free.# |