Here's a little snippet that doesn't do what I hoped:

        public static native void disableContextMenu(Element e) /*-{
                e.oncontextmenu = function() { return false; };
                }-*/;

And I call that method immediately before I add the minPanel to the
RootPanel:

                DataManager.disableContextMenu(mainPanel.getElement());

Now, not only do I not see the default browser behavior, I don't see
right clicks at all.  In my TextBox() I added the click handler.  When
the handler gets triggered, I get the NativeEvent from the ClickEvent
(NativeEvent nevn = event.getNativeEvent()) in order to detect which
button, etc, and the right button is never caught.

-- Rob


On Dec 8, 7:32 am, Mohamed Mansour <[email protected]> wrote:
> Can't you just return false for oncontextmenu ?
>
> On Dec 8, 5:01 am, Alexander <[email protected]> wrote:
>
>
>
> > Tried eventPreventDefault?
>
> > 2009/12/5 Rob Tanner <[email protected]>
>
> > > Hi,
>
> > > I want to add short context specific help messages when users right-
> > > click into a text box.  Figuring out what button the pressed on the
> > > mouse is a near no-brainer, but how to disable the default browser
> > > response is a puzzler.   I've figured out how to disable right clicks
> > > all together using the native interface:
>
> > >        public static native void disableContextMenu(Element e) /*-{
> > >                e.oncontextmenu = function() { return false; };
> > >                }-*/;
>
> > > But then I don't see them either.  All I want is to disable the
> > > default context menu so that I can roll my own.  Any ideas?
>
> > > Thanks,
> > > Rob
>
> > > --
>
> > > You received this message because you are subscribed to the Google Groups
> > > "Google Web Toolkit" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-web-toolkit%2Bunsubs
> > >  [email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > --
> > Regards,
> > Alexander

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to