Addressing a TreeView dynamically after being dropped on a Page

Started by Verity, August 13, 2008, 11:22:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Verity

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

Visio Guy

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?


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

Verity

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?