Multiple Selected Items in ControlList?
#1
Is there any way to return multiple selected items in a control list? I'm looking for something similar to what can be done in the XBMC file manager where you can select several non-contiguous items by clicking the Y button on the controller.

Thanks in advance.
Reply
#2
to highlight them you would need some trickery. maybe some separate image controls to overlay on top. then keep track of the marked items from the onAction() event.

It can be done, but the control itself does not support it.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
Actually wouldnt you have to know the current scroll value to calculate the absolute screen position? I dont think there is a way to get that.

Really there should just be a color field on ListItem.
Reply
#4
you could use a thumb image to keep track of what has been selected.
Reply
#5
The listitems have a selected bool on them already, but I guess it isn't exposed to python?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
Code:
void CGUIListItem::Select(bool bOnOff)

So just expose a select() method?

I can do that and submit a patch.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#7
Exactly Smile
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
Thanks,

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.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#9
Ok, It's done. It's a simple patch so I'm going to go ahead and commit it.

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.
Quote:self.list.getSelectedItem().select(True)
is = self.list.getSelectedItem().isSelected()
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#10
Wheres a thumbs up emoticon when you need it? Smile
Reply
#11
Nuka,

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.
Reply
#12
yeah, in onAction() have an if statement that toggles the selected status similar:

Code:
def onAction( self, action ):
    if ( action.getButtonCode() == 259 ): #Y button on controller
        self.listcontrol.getSelectedItem().select( not self.listcontrol.getSelectedItem().isSelected() )
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Multiple Selected Items in ControlList?0