3.2.0

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?

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

    #obj0  { left: 20px; top: 30px; }
    #obj1  { left: 20px; top: 50px; }
    #obj2  { left: 20px; top: 70px; }
  </style>
</head>

<BODY>
<script>
  function test () {
    return false;
  }

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

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

  var obj2 = new AW.UI.Label;
  obj2.setId("obj2");
  obj2.setControlText("Test Label 2 - included function call");
  obj2.setEvent("oncontextmenu", function (event) { return false; });
  document.write(obj2);
</script>
</body>
</html>
Mike
April 23,
Figured out obj0...

Change
obj0.setEvent("oncontextmenu", test);

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

This topic is archived.

See also:


Back to support forum