I have programatically added popup menu's to various toolbar buttons so that when I right click on the button the menu appears. However, the Google context menu also appears.
The right click is captured in the tb_Click event (client-side) and I popup the menu within this event routine with igmenu_showMenu. The menu appears, along with the Google context menu. I have tried setting oEvent.event.cancelBubble = true and oEvent.event.returnValue = false, and also Return false, but none of these stop Goggle.
I am using IE7, if that could make a difference.
Any suggestions?
I determined that had to capture the 'oncontextmenu' at the document level to stop this.
Basically, its a matter of returning False for the when the oncontextmenu event occurs, but since I didn't want to do this except for when I had previously captured the right click, I did the following:
CapturedRightClick = false;document.attachEvent('oncontextmenu', OnContextMenu);
function OnContextMenu() { if (CapturedRightClick) { CapturedRightClick = false; return false}}
function tbClick(oToolbar, oButton, oEvent) { if (oEvent.event.button == 2) { CapturedRightClick = true; igmenu_showMenu(menuname, oEvent, oEvent.event.x, oEvent.event.y)}}