Get position or triggering mouse event of MPopupMenu [message #1740198] |
Wed, 10 August 2016 07:12  |
Eclipse User |
|
|
|
I have a popup menu defined for a part.
I register the menu for a particular control using
menuService.registerContextMenu(xrefPane, "uk.co.xbundle.assembly.xrefs.popupmenu");
The popup menu successfully opens on a right click on the control.
The handler defined for one of the menu items has signature:
@Execute
public abstract void execute(MPopupMenu menu) {
...
}
This works, because the triggering popup menu is injected from the context.
I now need to access the xy of the right mouse click which triggered the popup menu, but I can't find my way through to this.
Does anyone know how to get this, or another idiomatic way to get the riggering MouseEvent through to the handler?
Thanks
Robert
[Updated on: Wed, 10 August 2016 07:13] by Moderator
|
|
|
|
|
|
Re: Get position or triggering mouse event of MPopupMenu [message #1740376 is a reply to message #1740252] |
Fri, 12 August 2016 08:28  |
Eclipse User |
|
|
|
Hi Tom
This attached screen shot shows a cross reference on a document on the right hand side. (This is the Text control showing "trial/1/2" in the left hand margin of the document)
A new cross reference is added by clicking "End XRef" on a popup menu, also shown.
The handler needs to know where on the document the popup was triggered in order to know where to place the new cross-refererence on the document.
That means getting some info about the triggering event, or the position of the popup, into the handler attached to the End XRef menu item.
MPopupMenu at the moment has no access to the triggering mouse event, or the position of the popup. Hence the clunky workaround by getting hold of the rendered component which I agree is less than ideal.
Could MPopupMenu eventually contain some triggering data do you think? It seems to me that popups will quite often need to pass positional data to handlers - e.g. adding components to a diagram via a popup etc.
Robert
|
|
|
Powered by
FUDForum. Page generated in 0.03783 seconds