Modify selection of masters in stencil?


    Sponsored Links


  • 1. Connecting Connectors
    I have created my own shapes which have an inward and an outward connection. I am able to connect connectors to the inward connection point but for some reason i cannot get a connector to connect to an outward connection point!? Why? I have read somewhere that outward connection points will only connect to inward connection points, is the reason? If so how do I go about making the Begin end of the connector an inward connection point? Many Thanks in advance for any help, James
  • 2. getting accurate shape count
    Hi, I'm writing a VBA macro and am running into problems with shape counts. My macro runs through all shapes on each page and performs a series of actions on each shape. My problem arose because I've deleted/added shapes several times and thus on most pages of my document, shape.count returns a number much less than the highest shape ID. Is there any way to get the largest shape ID on a page or a different work around? Also, I need to change the active window to a different document, how can this be done? Thanks in advance.
  • 3. How do I open a custom stencil in the shapes window
    I have a custom stencil that I need to programmatically show/dock in the shapes window. The stencil is a saved file vss. Thanks, Mike
  • 4. Adding dirctionality to connectors
    I am trying to simulate water flow through a system. On the custom shapes i have created such as pumps, sources and sinks etc i have been able to set the connection points as either inward or outward. However i am just using connectors(arrows) to represent pipes and am unable to preset on end as output and the other as input. The reason for me wanting to do this is to make sure i don't have two sources connected together as this is obviously physically impossible. Does anyone have ideas? Many thanks, James

Modify selection of masters in stencil?

Postby Gilgil0886 » Wed, 17 May 2006 01:19:43 GMT

I have a C# application hosting a Visio ActiveX control. The
application enables the user to create new masters (programatically).
However, when a new master is created (using Stencil.Drop()), it gets
selected, in addition to the already selected masters.
I know I can get the currently selected masters list from the windows
of the stencil, but is there a way to modify this selection?


RE: Modify selection of masters in stencil?

Postby SnVuZVRoZVNlY29uZA » Wed, 17 May 2006 10:28:01 GMT

This is the same case in VBA and Visual  Basic for Visio proper.
DeselectAll method applied to the stencil window could remove the selection.
In VBA this window could be got by Application.Windows(1).Windows(3).
These number might vary, and ItemFromID property may not be used in other 
language than VBA.


RE: Modify selection of masters in stencil?

Postby SnVuZVRoZVNlY29uZA » Wed, 17 May 2006 12:02:02 GMT

I've made mistake in ItemFromID. ItemFromID can be used in Visual basic also.

Re: Modify selection of masters in stencil?

Postby Gilgil0886 » Wed, 17 May 2006 18:59:45 GMT

Works like a charm. Thanks!

Similar Threads:

1.Visio 2003 - Org Chart from Excel Ignores Modified Masters in Document Stencil

2.Modifying masters in a stencil

Dear All,

I would like to programatically modify a stencil by changing the name and
some properties of the contained master shapes. (The name I want to change
is the name that is displayed below each master in the stencil.)
This is to be implemented in a C# application. However, for testing I wrote
the VBA macro below.

The macro works fine if the stencil is open for editing (mouse click onto
the top left corner of the stencil, then click "Edit").

Question: How can I enter a stencil's edit mode programatically? I tried
this via the AllowEditing flag or by closing and re-opening the stencil with
the 'visOpenRW' flag. Unfortunately, both did not work. I found several
newsgroup threads concerning this issue, but none of them really helped me.

Thanks a lot in advance for any hint!

Best regards,

Public Sub UpdateStencil()
    Dim myStencil As Document
    Dim myMasters As Masters
    Dim myMaster As Master
    Dim myMasterCopy As Master
    Dim myShape As Shape
    Dim index As Integer
    Dim win As Window

    On Error Resume Next

    Set myStencil = Documents("My Stencil.vss")
    myStencil.Title = "New Title"
    Set myMasters = myStencil.Masters
    For index = 1 To myMasters.Count
        Set myMaster = myMasters(index)
        Set myMasterCopy = myMasters(index).Open
        Set myShape = myMasterCopy.Shapes(1)
        myMaster.Name = "New Name"
        myShape.Cells("User.ELEMENT_ID").Formula = 12345
    Next index
End Sub

3.Modify a shape master and update all the shapes on the visio p

4.Modify a shape master and update all the shapes on the visio pages

my problem is the following:
1) I create a new shape master
2) I use it many times in a one or more visio pages
3) then when I make a modification on the shape master I would automatically 
update all the shapes on the visio pages I used before; is that possibile? 
Please, help me!

5.DoDragDrop on modified master shapes has strange side-effect

The scenario is the following:

I have a tree which I drag shapes from. When dragging the item, i find its 
corresponding master in the document stencil (via doc.Masters.get_ItemU) and 
DoDragDrop(foundMaster, DragDropEffects.Copy) on the master shape I get.

After doing this a couple of times (and it works as it should) i edit (in 
visio) the master shape in the document stencil. After updating all 
references i try dragging another one in from my tree. The dragged object 
looks fine, but when releasing/dropping the shape on the drawing surface, the 
text is renamed to what it was before, and another master is created in the 
document stencil.

Why is this happening? My code find the correct master since the text is 
correct when dragging the item without releasing it... But Visio does 
something when i release it. I know that the UniqueID changes when editing 
the text, but should this really be a problem?

If i edit the master in the document stencil before doing any drag-and-drop 
operation, then drag-and-drop works (no change of text and no new master 
shape), but immediately after editing the master, it starts acting weird!

Dragging the master from the document stencil works fine in every case.

Another thing:
I have also noticed that the icon when my drag-and-drop operation is going 
on, is more like in windows explorer, but when using the document stencil 
it's only a small 'plus' sign. What is the difference?.. How can I access 
Visios internal drag-and-drop functionality?

6. Modified Shape Masters have funny effect on Text Placement

7. master shape in stencil versus document stencil

8. How to update document stencil master from stencil

Return to VISIO


Who is online

Users browsing this forum: No registered users and 46 guest