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 [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
-~----------~----~----~----~------~----~------~--~---