Modify Master Shapes

Started by tomkinsr, June 12, 2012, 01:16:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tomkinsr

I wanted to learn some more about Visio 2010 and so I copied the Organization Chart Stencil to My Stencils.

I opened my Organization Chart stencil and clicked on Edit Master Shape.

I inserted a new text field from the shape data, "DEPARTMENT", and closed and saved everything.

I created an ew Orgnaization Chart, closed the Microsoft Organization Chart stencil and opened my now modifed copy of the Organzation Chart stencil.

As I dragged the now modified shape from the stencil to the sheet I could now see DEPARTMENT in the ext and felt like I was really on to something.

I dropped the shape onto the sheet and DEPARTMENT never showed up.

I am reallts bummed out about this.

I opened up my stencil and yes, it is as I had modified it.

Any ideas? Is it supposed to be so hard to get anything to work properly?

Jumpy

Could be two issues (I think?):
1) There is an instance of the old mastershape still in the document stecil of your drawing:
If you now drop your modified shape (based on your new master) on the drawing, Visio "sees" the old master in the document stencil, "thinks" this is the same as the new master and places a copy of the old master as the new shape on the drawing. That can happen if old and new master have the same name.

2) The AddOn behind the Org-Chart overrides your changes and replaces you new mastershape with the one it "knows".

Problem 1) can be solved by using a new blank page perhaps based on an empty template, or deleting all mastershapes in the document stencil.

Don't know if there's a solution to Problem 2). Maybe you can add the new ShapeData entries you need with VBA on drop?

hth Jumpy

JohnGoldsmith

Have a look at this recent post by David Parker where he deals with creating a custom Org Chart template:

http://blog.bvisual.net/2012/05/08/creating-a-custom-org-chart-template-with-extra-properties/

If you've not used code before you can ignore that part and just make changes to the masters manually.

A number of add-ons (including Org Chart) make use of 'persistent events' that are things that enable you (as a developer) to react to certain events in the lifecycle of the document.  They are defined in the document and you can see them by using the Persistent Events tool in the Visio 2010 SDK:

http://www.microsoft.com/en-us/download/details.aspx?id=12365

If you create a custom Org Chart template that you want to make use of the add-on then you'll need to ensure that your new template includes these events, which subscribe to the add-on functionality.

Re the department field, I agree with Jumpy - it's likely that your master is not being used.  I don't know if the add-on is expecting to see a stencil named "Organization Chart Shapes" (I would guess so) but one of the actions on open (via the persistent events) is to pre-populate the Document stencil (from the original stencil).  This means that when you drop your modified master onto the page, Visio looks in the Document stencil, finds one of the same name and uses that instead.  David's solution is to modify the Document stencil masters and that way the correct custom masters are instantiated when you do a drag drop onto the page.

Hope that helps.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

tomkinsr

Thank you.
I had already installed the SDK and switched on Developer.
I see the issue with the shape behaviors, and the Microsoft developers should eat ... wahtever vile substance you can think of.

If I open a blank page, then open my stencil, the moment I try to add a shape I get,
active document should have the 'organization chart' template open for this operation
poping up a dialog window.
What absolutely moronic behavior.

For $1200.00, I guess that's what you get, CRAP!

JohnGoldsmith

#4
The Org Chart solution is based on an add-on, a template and a stencil and it seems reasonable that the add-on should know both the type and state of the document it's dealing with (something that gets setup via the persistent events in the template, on which the document is based).

If you just want to use the Org Chart shapes and not the benefits of the add-on then you can just remove the formulae in the masters that refer to the add-on - for example (from the Events ShapeSheet section):

EventDrop = RUNADDONWARGS("OrgC11","/cmd=ShapeDropped")

Note, there are many other references to the add-on that provide other functionality (eg in the Actions section), so you'd have to remove those too, although you'd end up with a pretty static document.

If you want to extend the existing functionality of the Org Chart solution then you have to work around what's already there and David's post provides one way of doing that.

Re-reading your original post I'm not clear on whether you've just picked Org Chart as candidate for learning more about Visio or if you have a specific Org Chart problem you're trying to solve.  If it's the former, then it might be easier to focus on a template that doesn't already rely on an add-on, but if it's the latter then perhaps you can jot down more about what you're trying to achieve overall.

I hope that's helpful.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

Paul Herber

tomkinsr, how the org chart system works is nothing at all to do with Microsoft, they bought Visio about 12 years ago, it was all history even then!
The org-chart templates, stencils and addon are all designed to work together to create a certain type and format of diagram, Visio just provides the background capabilities of templates, shapes etc. Trying to change one small part of it, with all due respect, without enough knowledge to know what effect what is not going to work.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

aledlund

Paul,
He's dropping an OrgChart shape on a blank page and the shape is triggering the call to the Wizard. Visio is just telling him that the shape has to be used within the OrgChart Solution.
al

Paul Herber

Hi Al, yes, I fully realise that. I'll guess it's the shape's OnDrop event calling the OrgChart addon which then finds it can't work with that blank template. However, is there any real reason the addon couldn't modify the document to suit its requirements?

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

aledlund

It's probably a lot more likely that this gentleman will learn Visio, rather than MS will rewrite the addon to work with a document that wasn't built with the correct template (persistent events, user cells in pagesheet, user cells in docsheet, appears to prepopulate the masters to the doc stencil, etc.). The question becomes one of after he adds the shapedata fields that he wants does he still expect the shape to perform as it would in the solution.
al

Paul Herber

Well, looking at his responses to replies on the Answers forum I have my doubts.
Any abuse here and I'll be ready with the delete and block buttons.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

georgejost

Quote from: Paul Herber on June 18, 2012, 10:41:56 AM
Well, looking at his responses to replies on the Answers forum I have my doubts.
Any abuse here and I'll be ready with the delete and block buttons.

I'm faced with the same problem as the OP.

In my case, I only want the shapes and I don't want the extra crap built into the org chart VSS.

How do I create my own VSS with the shapes (and the dynamic connector) but without all the idiosyncracities of org chart which I do not want at all.

For example, I tried making a new stencil and drop dropping the Executive, Position and Dynamic Connector symbols into it with "icon and name only". When I try to use this from my code, same issues
a) I can only make one dynamic connection originating from a given shape.
b) I get the message about needing the "Org chart template" which I totally do not want.

Sorry that the topic is resurrected. I've been spending 2 days googling and found lots of people trying to ask simular questions but haven't found anybody supplying an answer I can use yet