Loading ...
Sorry, an error occurred while loading the content.
 

How can I prevent right-click context menu?

Expand Messages
  • mark.deibert
    I m trying to catch a mouse right-click event and handle it but I keep getting the Windows context menu. None of... YAHOO.util.Event.stopEvent(myEvt)
    Message 1 of 2 , Dec 29, 2006
      I'm trying to catch a mouse right-click event and handle it but I keep
      getting the Windows context menu.

      None of...

      YAHOO.util.Event.stopEvent(myEvt)
      YAHOO.util.Event.preventDefault(myEvt)
      YAHOO.util.Event.stopPropagation(myEvt)

      in any order, inside the handler, does anything at all. Yes, 'myEvt'
      is the event.

      How can I do this?

      Thanks guys :-)
    • mark.deibert
      Put this in your main code... YAHOO.util.Event.on(document, click , function(e) { if (e.button == 2) { d6EVENT.onRightClick.fire(e);
      Message 2 of 2 , Dec 29, 2006
        Put this in your main code...

        YAHOO.util.Event.on(document, 'click', function(e)
        {
        if (e.button == 2)
        {
        d6EVENT.onRightClick.fire(e);
        YAHOO.util.Event.stopEvent(e);
        }
        });

        So here I catch the rigt-click and fire my own custom event, then stop
        the event.

        This works :-)




        --- In ydn-javascript@yahoogroups.com, "mark.deibert"
        <mark.deibert@...> wrote:
        >
        > I'm trying to catch a mouse right-click event and handle it but I keep
        > getting the Windows context menu.
        >
        > None of...
        >
        > YAHOO.util.Event.stopEvent(myEvt)
        > YAHOO.util.Event.preventDefault(myEvt)
        > YAHOO.util.Event.stopPropagation(myEvt)
        >
        > in any order, inside the handler, does anything at all. Yes, 'myEvt'
        > is the event.
        >
        > How can I do this?
        >
        > Thanks guys :-)
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.