How to pop up a dialog to select an item
#1
I need to give the user a choice of items to select.

I've tried this

Code:
wxml = xbmcgui.WindowXML("DialogSelect.xml", "")
wxml.getListItem(1).setLabel("Title of box")
wxml.addItem('test 123')
wxml.addItem('test 456')
wxml.addItem('test 789')
wxml.doModal()

... but I only get a blank dialog with "Picture Information" as the title. I just need to add a list of ListItems or strings, which are selectable by the user, and I need to know which they select after pressing enter or clicking OK.

It's not clear to me if WindowXML.getListItem should return a string, or a Control object, because when I try Control methods on it, they fail.

Any help appreciated
Thanks
Reply
#2
I think this is the simplest solution:
Code:
dialog = xbmcgui.Dialog()
entries = ["Entry1", "Entry2", "Entry3"]
nr = dialog.select("Dialog_Title", entries)
if nr>=0:
    entry = entries[nr]
Reply
#3
Thanks -- looks much easier than the way I was trying! It seems to work.
Reply

Logout Mark Read Team Forum Stats Members Help
How to pop up a dialog to select an item0