Triggering Context menu from a button?
#1
Question 
Hi Guys,

Sorry if this is obvious, but I have gone looking and I can't find how to bring up a "Context" menu from a button. I am currently playing around with a new skin concept and need some way to bring up the context menu from a mouse/touch interface. I have tried looking in a number of Touch compatible skins and don't see anywhere that the context menu is called.

Could someone please point me in the right direction for finding this (pointing and laughing is expected and entirely up to you).

Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#2
Did you try with:

ActivateWindow(contextmenu)

http://kodi.wiki/view/Window_IDs
Reply
#3
Context menu is only available for items that have context options.
If a button has focus, the item does not have focus so xbmc has no idea what to fill the menu with.
On touch you can open context by long press (hold) on the item.
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#4
Yep ofcourse you're right, ignore my post please.
Reply
#5
I implemented a right-click menu for home window in my skin by using a script window instead of home.xml. works great, but you have to deal with python.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#6
(2014-10-22, 16:22)phil65 Wrote: I implemented a right-click menu for home window in my skin by using a script window instead of home.xml. works great, but you have to deal with python.
@butchabay @MassIV thanks for the suggestions, was trying to make this happen in MyVideoNav and was only really a potential goer in a list view anyway.

Will go take a look at phil65's skin and see if there is a potential to make use of the script idea he is talking about.

Thanks again for the sounding board guys.
Wyrm
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#7
just a remark: I am not sure if the method I am using would ever be allowed for an official-repo skin since it breaks the default keymapping (<home> keymap part wont work anymore)
If you could be more specific about what you want to achieve I could probably give you some other ideas.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#8
(2014-10-22, 09:12)butchabay Wrote: Did you try with:

ActivateWindow(contextmenu)

http://kodi.wiki/view/Window_IDs
(2014-10-22, 12:01)MassIV Wrote: Context menu is only available for items that have context options.
If a button has focus, the item does not have focus so xbmc has no idea what to fill the menu with.
On touch you can open context by long press (hold) on the item.
Now this is something I'm missing in current skins. I'd like to see a button next to a list item that let's you trigger the context menu - but his is not possible as you just said? If so, we should get this added to core.
Reply
#9
(2014-10-22, 18:26)da-anda Wrote: Now this is something I'm missing in current skins. I'd like to see a button next to a list item that let's you trigger the context menu - but his is not possible as you just said? If so, we should get this added to core.

Problem is that this would not really work with all view layouts. (it would suck for panel containers for example)
Should be the skinner´s choice to implement such a button if it would ever get into core.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#10
As said it wouldn't work when using a panel view.

Interested in why press and hold isn't sufficient though?

The only other way would be a change to the core where clicking can be changed between Context, Info, and Play.
Reply
#11
What I was trying to achieve was to allow the user to trigger the context menu for each item in a list by either moving to the side (for remote users) or touching a arrow button on the edge of the list item (for mouse or touch users). This was before I found out about the long press to trigger the context menu (thanks for that Hitcher) and me realising that as phil65 pointed out that it would not work for a panel view.

Overall reason for this and other questions is that I am helping someone with a skin concept for a touch enabled device and I have never dealt with touch in a skin before, so I'm learning what I need as I go along. Each set back is an opportunity to learn something new. That and hopefully I can apply the new knowledge to a on again/ off again project of my own.

As to the idea of providing a way to call this menu (context) from within a skin, while on first thought it seems like a good idea, again anything involving a panel view would make it unworkable, so I don't see a lot of point following up on this. Just my 2c on this.

Wyrm
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#12
You can't call the ContextMenu via ActivateWindow(), however you can call it with the keymap shortcut ... it is as simple as :
Code:
<onright>ContextMenu</onright> (e.g. for a list)
...

edit:
for a button (onclick) outside of the container you might have to focus back to the item in the container/list before executing "ContextMenu", something like this :
Code:
<onclick>SetFocus(100) </onclick> <!-- Replace 100 with your container / defaultcontrol (viewmodes) id -->
<onclick>ContextMenu</onclick>
Reply

Logout Mark Read Team Forum Stats Members Help
Triggering Context menu from a button?0