PDA

View Full Version : Menu inside Window?



janhov
16 Apr 2010, 4:14 AM
According to the menu tutorial:

- "A menu can be assigned to different places inside a UI"
- "(...) menu to show up when the user clicks on a button anywhere in the page"

Is it possible to put a basic menu inside a window? Or even better, just make it show up on some x,y position? I don't want to attach it to a toolbar.

What I want to do is to make a Windows-like right-click menu for features in an OpenLayers vector layer.

Something like this:
http://folk.uio.no/janhov/div/menu.jpg

mpawlowski
16 Apr 2010, 8:57 AM
Add a context menu listener to an object, then stop the browser right clock and show the menu at the current XY position. Check the API for the exact paramters of the contextmenu listener.


listeners: {
contextmenu: function(param1, param2, ..., event){
event.stopEvent();
menu.showAt(event.getXY());
}
}

I think that solves the issue you are having. If not, let me know.

janhov
17 Apr 2010, 2:16 AM
Thank you. Was not aware of the contextmenu event. *RTFM* :">