Context Menu's

I'm trying to set up context menus on labels for various reasons. The problem I'm running into is that the windows context menu continuously pops up also. In the following code, I have 3 ways of generating the menu all 3 of which I think should be blocking the windows version. I've done context menus a number of times now and am the one that posted the example using things I found here back in November.

Am I maybe using the wrong event setter? or the wrong event name? I tried onContextMenu but that broke it entirely. I also saw some references to setAttribute instead of setEvent but I need the event object for determining where to make the context menu so I don't think that works (at least it didn't when I tried). Ideas?

  <LINK href="/ActiveWidgets/runtime/styles/aqua/aw.css" rel="stylesheet"></LINK>
  <SCRIPT src="/ActiveWidgets/runtime/lib/aw.js"></SCRIPT>
    .aw-system-control {position: absolute}

    #obj0  { left: 20px; top: 30px; }
    #obj1  { left: 20px; top: 50px; }
    #obj2  { left: 20px; top: 70px; }

  function test () {
    return false;

  var obj0 = new AW.UI.Label;
  obj0.setControlText("Test Label 0 - seperate function call");
  obj0.setEvent("oncontextmenu", test);

  var obj1 = new AW.UI.Label;
  obj1.setControlText("Test Label 1 - direct disable");
  obj1.setEvent("oncontextmenu", "return false;");

  var obj2 = new AW.UI.Label;
  obj2.setControlText("Test Label 2 - included function call");
  obj2.setEvent("oncontextmenu", function (event) { return false; });
April 23,
Figured out obj0...

obj0.setEvent("oncontextmenu", test);

obj0.getContent("box/text").setEvent("oncontextmenu", test);
April 24,

This topic is archived.

See also:

Back to support forum