:: Forum >> Version 2 >>

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 {positionabsolute}

    
#obj0  left20pxtop30px; }
    
#obj1  left20pxtop50px; }
    
#obj2  left20pxtop70px; }
  </
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
Monday, April 23, 2007
Figured out obj0...

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



This topic is archived.

Back to support forum

Forum search