Domanda

I my Gadget application i have an issue with showing standard gadget context menu. The problem caused because of silverlight control, when i click right button Silverligh control handle contextmenu event.

So first my solution was to put on top of the silverlight control transprent web control (table). Well that way i got good working gadget context menu and not working silverlight control. So the next step was to make transperent web control invisible and handle oncontextmenu. Like this.

HTML

<body oncontextmenu="ContextMenu();" onload="init();" >

JavaScript

ContextMenu()
{
var vis = document.getElementById('overlapControl').style.visibility;
if (vis == "hidden") {
    document.getElementById('overlapControl').style.visibility = "visible";
    window.event.returnValue = false;
}

It's working with some glitches. You need to make two right button clicks, and some event to hide transpanent control. The second one is not a big problem, i can use onmouseover event for example to hide control. But a first one is a real pain in the neck. Seems there is no way to show context menu with one click.

Any ideas how to make it work. or maybe other better solution.

È stato utile?

Soluzione

Have you tried windowless mode? Here is a little more complicated example, but should give you some idea.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top