To re-iterate what has already been said: you can't truly disable this menu in
Opera (in fact you
won't even get the event by default).
However, if you are determined to try, this may help:
public class MyRichTextArea extends RichTextArea {
public MyRichTextArea() {
addDomHandler(new ContextMenuHandler() {
public void onContextMenu(ContextMenuEvent event) {
// open your popup menu here
event.preventDefault();
}
}, ContextMenuEvent.getType());
}
}
This should work as expected for most browsers.
Taimur Mirxa wrote:
> I have checked the GoogleDocs application, in Google docs, it is also
> showing the customized menu instead of broswer's menu. hope if you guys
> can come up with any idea how it is accomplishing it?
>
> the snap is also attached with this email.
>
> 2009/11/3 Dimitrijević Ivan <[email protected] <mailto:[email protected]>>
>
>
> Do not use right-mouse click popup menu. This is not supported by all
> browsers. For instance, in Opera you should change configuration in
> order to allow scripts to handle context menu events. Instead you can
> detect mouse-over event, and depending of object which is hovered, you
> can display a panel that contain options (Just like MS Word does, or
> GMail when you select picture).
>
>
> On Nov 3, 6:46 am, Taimur Mirxa <[email protected]
> <mailto:[email protected]>> wrote:
> > Mike,
> >
> > I really appreciate your help, but this is not working in
> firefox. on the
> > other side this method is working fine in hosted mode and IE. any
> idea?
> >
> > On Mon, Nov 2, 2009 at 12:04 PM, Michael Sullivan
> <[email protected] <mailto:[email protected]>>wrote:
> >
> >
> >
> >
> >
> >
> >
> > > In your client code somewhere, create this native function:
> > > protected native void blockBrowserContextMenu(Element
> elem) /*-{
> > > elem.oncontextmenu = function(e) {
> > > return false;
> > > };
> > > }-*/;
> >
> > > Then, when you create your RichTextArea, call 'getElement()' on
> your
> > > RTA instance and pass it to the given native method.
> > > That will block browser context menus for that instance of
> > > RichTextArea and for no other part of your UI. (Though you may
> want
> > > to consider
> > > re-implementing Cut/Copy/Paste on your custom menu, as they may be
> > > expected by your users).
> >
> > > Mike
> >
> > > On Nov 2, 8:39 am, Taimur Mirxa <[email protected]
> <mailto:[email protected]>> wrote:
> > > > Folks,
> >
> > > > I have created my own popup menu, which I want to display in
> > > RichTextArea,
> > > > and it is appearing with right mouse click. my problem is
> that default
> > > > broswer's context menu does also appear along with my menu.
> is there any
> > > > resolution for this?
> >
> > > > I have seen lots of examples and code but all of them were
> disabling
> > > > broswer's default menu that shows View Source and other
> options, I do not
> > > > want to disable it, rather my point is to disable the context
> menu which
> > > > appears in text fields or rich text areas.
> >
> > > > --
> > > > Warm Regards,
> >
> > > > Taimur Mirza
> >
> > > > [To predict the behavior of ordinary people in advance, you
> only have to
> > > > assume that they will always try to escape a disagreeable
> situation with
> > > the
> > > > smallest possible expenditure of intelligence. - Friedrich
> Nietzsche]
> >
> > --
> > Warm Regards,
> >
> > Taimur Mirza
> >
> > [To predict the behavior of ordinary people in advance, you only
> have to
> > assume that they will always try to escape a disagreeable
> situation with the
> > smallest possible expenditure of intelligence. - Friedrich
> Nietzsche]
>
>
>
>
> --
> Warm Regards,
>
> Taimur Mirza
>
> [To predict the behavior of ordinary people in advance, you only have to
> assume that they will always try to escape a disagreeable situation with
> the smallest possible expenditure of intelligence. - Friedrich Nietzsche]
>
> >
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---