Custom context submenu
#1
Hey, I'd like to use a custom context submenu in one of my scripts. Is there an easy way to launch such a menu from a script? I've read in a thread that script.globalsearch is using such a custom menu, but I can't understand the concept behind it.
Reply
#2
as of kodi v17 krypton, it's very easy to create a custom context menu.

Code:
selected = xbmcgui.Dialog().contextmenu(list=["option1", "option2"])

it returns position of selected item, or -1 if cancelled.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
I added this to one of my addons yesterday. Works great:
Code:
dialog = xbmcgui.Dialog()
tools = __get_tools(path)
try: ret = dialog.contextmenu([i[0] for i in tools])
except: ret = dialog.select('Tools', [i[0] for i in tools])
if ret > -1:
    tools[ret][1](*tools[ret][2])
Reply
#4
Thank you guys. I get more and more excited for Krypton.
Reply

Logout Mark Read Team Forum Stats Members Help
Custom context submenu0