Prevent copy of subshape

Started by AndyW, September 14, 2009, 10:22:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AndyW

Visio 2003

I have a shape with a sub-shape that is selectable to allow the user to resize a text box, change formatting etc. The subshape is also locked to prevent deletion. However, the user is able to select the sub-shape and copy this (Ctrl-C) and subsequently paste it (Ctrl-V). I want to prevent my user from being able to do this, obviously thet can copy/paste the parent shape, but not components. Also, if they have succeeded in the sub-shape copy/paste they can't delete this as the sub-shape is locked for delete.

There doesn't seem to be an event I can catch for the copy action. I have tried using the enterscope to catch the copy. I can catch the copy by doing this, but there are no shapes in the selection. At the moment I am catching the selection added/chenged event when the paste occurs and then deleting the shape if it is locked for delete. Ideally I would like to prevent the copy in the first place.

Any suggestions welcomed.
Live life with an open mind

Visio Guy

Hi Andy,

I can't think of any easy way to prevent copy, and the catch-paste-delete is probably a pain.

Any chance you can get the text on the sub-shape to auto-size using ShapeSheet formulas? (start with: Top Twelve Text Tips)

Or control handles at the top level that users can drag to resize the text sub-shape? Then you could more effectively lock down the group and be rid of this concern.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

AndyW

Thanks, but in that case I think I am left handling the catching, paste of the sub-shape and then deleting it. It just makes it all a bit more complicated.

I have tried to lock down my group shapes as much as possible, but my user needs to be able to resize the height/width of the text box, rotate etc. I already use a control point for the position, but adding control points for all the others would make it seem complicated for the user. I also have shapes where there are connectors that are sub-shapes that then need to be selected and connected to other shapes.
Live life with an open mind

Visio Guy

There might be a way to disable the copy function and its keyboard accelerators if a sub-shape is selected. But this is a lot of watching and analyzing for a rare (?) case...

Wish I had a better answer!
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

vojo

so here are 2 "off the wall" ideas:

you could set the event on drop action to set the size of the subshape to be 0mm x 0mm.   In essence, this would make the subshape disappear if copied and if you set the handles to not show then there would be no way to ever find it (no handles show when scoping a region and the shape is not visibile to actually select).

Of course the downside is that when the user gets frustrated and tries copying this 1000 times, the file will grow in size signficantly and you and user would have no way to ever to weed out the "phantom" copies floating around.

Another approach is to put the shape on a background page and just have  a text block on foreground that manages the text and could pass some (but not all) formating info the background shape via props.cells.

If he copies text block, the background still takes direction from original shape....new foreground is just a "dangling" text block in the wind.

Visio Guy

Nice ideas, vojo!

The on-drop idea is interesting. If the text contains inserted data, you could set the text's reference-cell to say "Bad User" on drop.

On drop for the sub-shape could also unlock any guarded formulas. For instance:

  EventDRop = SETF(GETREF(Width), Width)

This will blow away any formulas in the Width cell and replace Width with its own current value.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

aledlund

Just out of curiousity, if you take vojo's recommendation on sizing, does the 'unseen' shape show up in the drawing explorer?
al

vojo

I believe it does.....but not sure how you would find the coordinates of its location since handles off.
I suppose you could put a "back door" in the master shape / stencil that would allow show the shape if somebody edited the document stencil.   

ie have a user cell in master shape
   1 = hide good stuff (0mm, handles off)
   0 = show good stuff (say 20mm, handles on)

That way, could always clean up the drawing or file if need be.   Edit the master in doc stencil,,,voila all the shapes are shown.

Note, if the subshape is really a group itself, the geomety appraoch is the best way (width =0mm, height =0mm).  If subshape is really a simple shape, could look at geometry1.noshow....though would have to set all geometry sections appropriately...so maybe width/height better anyway.

Visio Guy

I couldn't resist, have a gander at the attached Visio file...

The sub-shape in the group has GUARDed PinX and PinY cells, to simulate real-world SmartShape construction.

Then, the EventDrop cell has a beast of a formula:

EventDrop = SETF(GetRef(Width),Width*3) +
                 SETF(GetRef(Height),Height*3) +
                 SETF(GetRef(PinX),PinX) +
                 SETF(GetRef(PinY),PinY) +
                 SETF(GetRef(FillForegnd),RGB(255,0,0))


This kills the guarded position, so the shape isn't "stuck" on the page. It also makes the shape 3 times bigger, and RED, so that the user will immediately notice that they've done something odd.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010