Visio Guy

Visio Discussions => Programming & Code => Topic started by: Verity on August 13, 2008, 11:22:05 AM

Title: Addressing a TreeView dynamically after being dropped on a Page
Post by: Verity on August 13, 2008, 11:22:05 AM
Hi,
like the topic says I'm trying to a drop a TreeView from a Master Shape. The ShapeAdded Event tells me that it was dropped, but I only have the reference to the Shape and the Shape does not have the functionality of the TreeView Object. Is it possible to address the TreeView Object so that I can add Nodes etc. ?

Thanks in advance Verity
Title: Re: Addressing a TreeView dynamically after being dropped on a Page
Post by: Visio Guy on August 13, 2008, 07:52:29 PM
Hi Verity,

You can drill down into the Shape object. This straight from the developer's help:

Object  Returns an IDispatch interface on the ActiveX control or embedded or linked OLE 2.0 object represented by a Shape object or an OLEObject object. Read-only.
ObjectIsInherited  Indicates if a shape represents an ActiveX or OLE object that is inherited from the shape's master. Read-only.
ObjectType  Returns an object's type. Read-only.

So something like shp.Object should get you closer. Are you using  VB or VBA or VB.NET or C# or...Delphi?


Title: Re: Addressing a TreeView dynamically after being dropped on a Page
Post by: Verity on August 14, 2008, 08:39:47 AM
Thanks,
I'm using VBA. Now I can insert the TreeView and add Nodes, but as soon as I add another TreeView it seems to forget all Nodes and only shows Sample Nodes. Another Problem I have encountered is that he only shows the added Nodes if I move the TreeView. I have tried .refresh but it does not seem to work. Visio seems to go into Design Mode to add the TreeView does that clear the Nodes? At first the added TreeView seems flat and I can't interact with it. Only after entering Design Mode and leaving it manually the TreeView is shown correctly.

Thanks in advance Verity

Edit: Another Question: How do add a Menu to the Nodes so I can add/delete?