How to ProtoUI Template and MouseEvents for context menu


I am trying to create a protoUI by combining Template and MouseEvents, like in this snippet:

I am doing so as to attach a context menu and be able to use the onBefore & onAfterContextMenu events. I know I can attach to the template's $view, but I need the onBeforeContextMenu event in order to update the context menu before showing it. Getting click events would be a nice plus, too.

The problem is, that when I add the required onContext: {} to my protoUI template definition, I get a script error.

Is there an alternate way to achieve what I am trying to do?

Thank you.


  • edited August 2018


    Thank you for your reply. That snippet is a step in the right direction, but not quite what I meant.

    I am trying to hook up this protoUI template component to a contextmenu component, like so:
    There is no script error, but no contextmenu component shows either. I know if I make the master of the contextmenu the $$('body').$view the contextmenu component shows, but that would not trigger the onBeforeContextMenu event I would like to attach to the template.

    Thank you kindly.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!