Re: Event Cancel for Middle Button on Firefox 2

2008-10-08 Thread Chris



On Oct 8, 5:30 am, Thomas Broyer <[EMAIL PROTECTED]> wrote:
> On 8 oct, 08:27, Chris <[EMAIL PROTECTED]> wrote:
>
> > I am trying to override the middle button click on FF2.  I can capture
> > the middle button mouseup event; but it seems that the default FF
> > action of opening the link in a new window/tab is not stopped.
>
> What happens if you preventDefault the "click" event?

Thanks for the idea.  preventing and/or canceling the click event
doesn't work either.

I did some digging and found this article which states the middle
click can not be suppressed in FF.

http://unixpapa.com/js/mouse.html

Guess I'll have to figure out some other mouse/key combination to have
a single click for opening a new window.

Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Event Cancel for Middle Button on Firefox 2

2008-10-08 Thread Thomas Broyer



On 8 oct, 08:27, Chris <[EMAIL PROTECTED]> wrote:
> I am trying to override the middle button click on FF2.  I can capture
> the middle button mouseup event; but it seems that the default FF
> action of opening the link in a new window/tab is not stopped.

What happens if you preventDefault the "click" event?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Event Cancel for Middle Button on Firefox 2

2008-10-07 Thread Chris

I am trying to override the middle button click on FF2.  I can capture
the middle button mouseup event; but it seems that the default FF
action of opening the link in a new window/tab is not stopped.  I am
using the following:


   private class SubMenuLink extends Hyperlink{

  public SubMenuLink(String text, String view){
 super(text, view);
 sinkEvents(Event.ONCONTEXTMENU);
 sinkEvents(Event.ONMOUSEUP);
 sinkEvents(Event.ONMOUSEDOWN);
  }

  @Override
  public void onBrowserEvent(Event event){
 super.onBrowserEvent(event);
 if(DOM.eventGetType(event) == Event.ONCLICK) {
; //do nothing
 } else if(DOM.eventGetType(event) == Event.ONCONTEXTMENU) {
DOM.eventPreventDefault(event);
Window.alert("context sub menu link");
cm.show(this, new String[]{"target",
getTargetHistoryToken()});

 } else if(DOM.eventGetType(event) == Event.ONMOUSEUP) {
switch(DOM.eventGetButton(event)){
   case Event.BUTTON_MIDDLE:
  DOM.eventPreventDefault(event);
  event.cancelBubble(true);
  Window.alert("middle sub menu link");
//  openInNewWindow(new String[]{"target",
getTargetHistoryToken()});
  break;
}
 } else if(DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
DOM.eventPreventDefault(event);
event.cancelBubble(true);

 }
  }
   }

Is it possible to cancel the middle button click in FF2?

Chris...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---