that's great. I want that :-). Could you tell me how you managed to 'properly<br>recongnize a right-click event in the MouseDefeaults.js file on mousedown'?<br><br>
<div><span class="gmail_quote">On 2/21/07, <b class="gmail_sendername">Graham Davis</b> <<a href="mailto:gdavis@refractions.net">gdavis@refractions.net</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Well, I seem to have found the answer to my own question, so I thought<br>I'd email it to the list just in case anyone else needs to know how.
<br><br>Basically there is an oncontextmenu event for DOM objects. You can<br>assign this to a function and put any code you like in there, and then<br>return false at the end to ensure the event stops and doesn't display
<br>the browser's context menu. So I added this to my map object to disable<br>all browser context menus from appearing on the map like so:<br><br>map.div.oncontextmenu = function noContextMenu(e) {return false;};<br>
<br>Seems to work well in both IE and FF (haven't test Opera or on a Mac).<br><br>--<br>Graham Davis<br>Refractions Research Inc.<br><a href="mailto:gdavis@refractions.net">gdavis@refractions.net</a><br><br><br><br>Graham Davis wrote:
<br><br>>I'm trying to implement a right-click menu on my map, similar to what<br>>you see here: <a href="http://maps.ask.com/maps">http://maps.ask.com/maps</a>. I've been able to properly<br>>recongnize a right-click event in the
MouseDefeaults.js file on mousedown.<br>><br>>My problem is that the browser's own right-click menu also appears, and<br>>I need to disable or stop this. I've tried stopping the event from<br>>propagating in the mousedown function after my code (and in the mouseup
<br>>function since that is when the browser menu seems to appear) however<br>>this doesn't stop the browser menu from appearing.<br>><br>>Has anyone been able to implement a right-click menu on their map that
<br>>properly disables the browser's right-click menu?<br>><br>>Also, this might be of importance, but I'm using the vector branch of<br>>code. I've noticed that when not using a vector layer, the right-click
<br>>menu on the map brings up the image menu as you have clicked on an image<br>>in the map. When there is a vector layer overtop, right-clicking brings<br>>up the standard browser menu where you can view source and whatnot, so
<br>>the menus are different. However, I think any fix for this would work<br>>for both (and I have been testing everything I try both with and without<br>>a vector layer). So far nothing works.<br>><br>><br>
><br><br><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br><a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users
</a><br></blockquote></div><br><br clear="all"><br>-- <br>Robert Buzink, website ontwerp en ontwikkeling<br>Sint-Pietersaalststraat 123<br>9000 Gent<br>+32 (0)9 33 00 267<br>+32 (0)487 548 414<br><a href="mailto:post@robertbuzink.nl">
post@robertbuzink.nl</a><br><a href="http://robertbuzink.nl/webdesign">robertbuzink.nl/webdesign</a>