Context menu selection

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Fraz627
Posts: 22
Joined: Sat Jun 17, 2017 8:31 am

Context menu selection

Post by Fraz627 »

I am playing around with the context menu interceptor.
how would I determine which context menu is being selected, I guess what I'm trying to get at
is would like to know if I selected the tab context menu or cell context menu so the correct one could be modified.

Thanks
Open Office 4.1 on Windows 10
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Context menu selection

Post by JeJe »

Doesn't the interceptor give you the menu so you can look at the first menu item and its text or commandURL?

Edit... this tells you about the resource identifiers...

https://wiki.openoffice.org/wiki/User:A ... ementation
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Sébastien C
Posts: 111
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Context menu selection

Post by Sébastien C »

I understand that this does not exactly answer your specific question of whether this or that contextual menu is called.

I hear just as well that this code snippet is (partially) in French. But G****** Tr******* is your friend.

And you use the formula "I am playing around [...]".

So maybe this little gem will bring water to your mill for "playing"...
:D
LibreOffice v. 7.3.2.2, under GNU-Linux Mint and, in virtualization and just for tests, LibreOffice v. 7.3.2.2 an OpenOffice v. 4.1.12 under M$-W 10 :ouch: .
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Context menu selection

Post by JeJe »

I've been playing around with Sébastien C's linked to code (thanks, may use this myself - method works with writer too and it seems to be okay with calling your own custom menu and setting the context menu to CANCELLED)

In the Function ThisDocument_notifyContextMenuExecute try this

Code: Select all



  dim nn
  set nn = oATContainer.getbyindex(0)
  msgbox nn.commandurl

'I get the result:
'tab context menu - slot 26269
'cell - slot 26067



http://www.openoffice.org/api/docs/comm ... igger.html

(.text causes a crash)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply