Can a custom right-click action in a master shape work in the main document?

Started by danielj, September 20, 2024, 04:06:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

danielj

I have a custom master shape that I've created which has some custom actions added via the ShapeSheet.

When I drag that master shape into a drawing, the right-click context menu items do not show up.

Is there a way to make the custom context menu item visible in the document?

Thanks!

Surrogate

Quote from: danielj on September 20, 2024, 04:06:48 PMIs there a way to make the custom context menu item visible in the document?
You mean VBA macro?
Quote from: danielj on September 20, 2024, 04:06:48 PMWhen I drag that master shape into a drawing, the right-click context menu items do not show up.
This master shape entity on drawing have shapesheet's Action section?

wapperdude

Visio 2019 Pro

Nikolay

Most probably, your master contains more than one top-level shapes. It should contain only one, otherwise the shapes gt grouped on drop, and you get in the document a brand-new group shape without menus.

danielj

Quote from: Nikolay on September 20, 2024, 07:01:55 PMMost probably, your master contains more than one top-level shapes. It should contain only one, otherwise the shapes gt grouped on drop, and you get in the document a brand-new group shape without menus.

This was the issue - once I grouped everything in my shape (and re-did the context menu actions in the new group), the right-click context menu now shows up when I right-click the inserted shape in my main document.  Thank you!

However, there's a new issue now - although the right-click context menu commands now show up, the script doesn't run.  When I open up the master shape, I can right-click the command and the associated VBA script runs.  In the main document, when I right-click on the instance of the inserted shape, nothing happens.  How do I get the script that's embedded in the master shape to run?

Surrogate

Quote from: danielj on September 20, 2024, 10:49:43 PMHow do I get the script that's embedded in the master shape to run?
Script embedded in stencil, not in master shape.
We have same thread few days ago: how to assign a macro to a master in the stencil?
Quote from: Surrogate on September 19, 2024, 10:41:24 AMPlease try use formula with syntax like in EventDblClick Cell.
CALLTHIS("MyModule.MyMacro","MyStencil")Hope this picture can helps...
I hope this picture helps again!

Just place formula in Action cell.

danielj

Thank you, this was very helpful.  I didn't have the project name or module in the CALLTHIS function call.  Adding those in solved the problem.

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 284 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1149KB.
Tokens: post-login.
Cache hits: 13: 0.00140s for 26,603 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]