Pages: 1
Print
Author Topic: Modifying the right click menu in a document.  (Read 315 times)
gcrews
Member

Posts: 189


« on: January 24, 2012, 06:25:05 PM »

I searched though the Xmetal documentation and all I could find on modifying the right-click menu was the function Application.AppendMacro(). It seems as though you can't use that to add submenus or position the new item though. Is there some way to do that?
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1548



WWW
« Reply #1 on: January 24, 2012, 06:47:13 PM »

The context menu can be modified using the same APIs as the regular menus (same names but on the ActiveContextMenu object, and you should do it inside the On_Context_Menu event).

If you add a menu item to the context menu you can then add a menu item to that item (treat what you just added as an object), and as soon as you do so the first one becomes a sub-menu, with the second item(s) inside it.

The documentation doesn't have any good examples for doing this, but this demo script contains an example:

http://forums.xmetal.com/index.php/topic,738.0.html
Logged
gcrews
Member

Posts: 189


« Reply #2 on: January 26, 2012, 10:54:25 AM »

Thank you, that are exactly what I needed. I have another question now but I think the demo_contextMenuElemListAttrInsp.mcr answered it.
Logged
gcrews
Member

Posts: 189


« Reply #3 on: January 26, 2012, 12:29:10 PM »

Ok I got my macro code write, now I’m trying to figure out what macro file to put it in.
I was just coding it in topic_ditabase.mcr but I want my code to apply to topics, concept, task, and reference.
I also don’t want put the code in any macro files that may have custom macros by users.
What would be the best file to put my macro code in? 
I tried in the startup folder, database.mcr, ditabase_ditabase.mcr , macros.mcr, and xmetal.mcr but none of those places seemed to  have my On_Context_Menu code triggered in a topic file.
Would I have to  copy and paste my  macro code into 4 different  dtd macros?
Logged
Pages: 1
Print
Jump to: