Visio Guy

Visio Discussions => Programming & Code => Topic started by: perry59 on January 05, 2020, 09:11:03 PM

Title: ungroup on drop
Post by: perry59 on January 05, 2020, 09:11:03 PM
I know there are similar topics, please excuse if asked before.
I have some shapes on a stencil that I want to automatically ungroup when dragged from the stencil.
It appears there is no way to do this?
I know a macro can do this, but I do not want macro's in my templates.
There is a DOCMD that will ungroup, but when editing the shapesheet for a master in a stencil there are no events.
so I take it that all I can do is tell my users that these particular shapes need to be ungrouped when adding them from the stencil?
Thanks
Title: Re: ungroup on drop
Post by: vojo on January 06, 2020, 01:05:09 PM
if possible, then the docmd would be in the ondrop cell in the group shapesheet
Title: Re: ungroup on drop
Post by: perry59 on January 19, 2020, 11:51:25 PM
There is no events section in the stencil in which to add a DOCMD.

Thing is, in the stencil the items making up my object are NOT grouped, they are only grouped when drug off the stencil onto a drawing. That's the behavior  I'd like to change, but is probably not possible. I'll just have to tell my users to ungroup these items after inserting into a drawing.
Title: Re: ungroup on drop
Post by: vojo on January 20, 2020, 05:56:14 PM
in the "on drop" cell in the shape's shape sheet, put docmd(xxxx)
I don't think there is a docmd to ungroup a group...but check...if so, put it in the "on drop" cell

Assume docmd(1234) means to ungroup, then

eventdrop = docmd(1234)
Title: Re: ungroup on drop
Post by: Obsidian on January 21, 2020, 07:29:23 AM
Not 1234. visCmdObjectUngroup = 1052

DOCMD(1052)
Title: Re: ungroup on drop
Post by: Surrogate on January 21, 2020, 11:57:12 AM
Obsidian, you are right! Not 1234, it mean -
visCmdDistributeRight.

https://docs.microsoft.com/ru-ru/office/vba/visio/Concepts/docmd-docmd-commands

Title: Re: ungroup on drop
Post by: vojo on January 21, 2020, 05:55:41 PM
1234 was just an example.....I guess I should have said  eventondrop = docmd(<xxxx>)  since there a lot of codes