News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Moving shapes by moving the container, but not individually

Started by Visisthebest, March 26, 2023, 08:31:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

I have a specific challenge with achieving the following, is it possible with shapesheet formulas to get shapes to move only when the container they are in is moved, but not when the user tries to move the shapes individually?

(Ideally a solution where with VBA it is still possible to change PinX and PinY on the shape, but this is not a requirement as I can solve it in code anyway by temporarily removing the formula, then changing PinX/PinY on the shapes, and put the formula back)

Visio 2021 Professional

Yacine

Can you elaborate on the purpose, because I would otherwise suggest using groups?
Yacine

Visisthebest

The custom flowchart shapes (each a group shape) in the container are typically about 2 to 12 shapes (per container) that make up a logic unit in the flowchart (which runs from left to right, hence containers work well for this. The container heading is the name for this logic unit, the user should not be able to change these shapes and move them around in the container they are a standard that cannot be changed. Shapes are also protected against deletion for instance.
Visio 2021 Professional

wapperdude

Everything you describe can be done with a group, no code, except for cases you want to deliberately change.

The advantage of containers is the underlying code which allows you to see membership, placement ordering, growing in size as members are added/changed.  Said code also moves members with the container.  But, unlike a group, the members Pins X and Y refer to page location rather than parent location.  It's built-in.  It would, indeed, take code to lock the relative positions.  Conclusion:  for your specifications, stick with group.
Visio 2019 Pro

Visisthebest

Thank you Wapperdude, I thought of Containers because I want users to create 'standard parts' of a workflow and for them it is easier to arrange shapes in a container than to use grouping/ungrouping (users often don't understand that they can cause issues especially when ungrouping), but yes for how I want it to work a group is more suitable.

Another aspect, I haven't used group shapes in group shapes before, worried that this may cause performance or other issues, but maybe unnecessarily worried about this.
Visio 2021 Professional

Surrogate

You can change group shape setting Accept dropped shapes (make this option checked). For shape - Add shapes to groups on drop.

Because of these changes you can do without ungrouping, just move the internal shapes outside the group...

Visisthebest

Thank you Surrogate! That does make it easier for end users to create a group shape by just dropping in shapes in to the group :D
Visio 2021 Professional

Surrogate

Quote from: Visisthebest on March 27, 2023, 06:19:42 AM
That does make it easier for end users to create a group shape by just dropping in shapes in to the group
Yes, it's even easier to use the hotkeys
For shape (receiver): Ctrl+G (make group), Alt+L+B+D (Accept dropped shapes).
For other shapes: Alt+L+B+H (Add shapes to groups on drop).
Or even write macro or add-in for automate these actions  8)

Visisthebest

Thank you Surrogate handy to know for myself but I will probably write a macro for this for end users, they often have difficulty with hotkeys where they have to press more than 2 keys.
Visio 2021 Professional

Yacine

Not really. You are preparing a stencil anyway. So set the drop properties before hands for the group and the sub-shapes. Your users don't need to worry about them at all.


The macro would only be useful if you want to allow the users to add freely created new shapes.
Yacine

Visisthebest

For the group shape (the 'fake' container) you're right Yacine, but will allow users to user their own workflow shapes, so for these it is nice a bit of code can configure them properly for the user (I am adding some user fields in code already, so might as well set the shape to be droppable in to a group).
Visio 2021 Professional

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: 388 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1194KB.
Tokens: post-login.
Cache hits: 14: 0.00279s for 26,721 bytes (show)
Cache misses: 4: (show)
Queries used: 18.

[Show Queries]