treeview in visio

Started by david, August 17, 2008, 02:07:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

david

i want to add a treeview to visio.
i clicked the insert control button on the developer toolbar and chose "Microsoft Treeview Control, version 6.0".
how can i learn more about this specific control?  i want to know how to add a shape to the treeview whenever i move a shape from the stencil to the frame.  or to move a shape to a group in the treeview.  i'd really like to read good material about this control because i couldn't find at google.  anyone can recommend me where to look?  i know nothing about treeview for now.  in fact i'm not even sure i chose the right control.  there's also "Microsoft TreeView Control, version 5.0 (SP2)" and i don't know the difference between version 6.0 and version 5.0 and which one of them i should use.

i'd really appreciate your answer.

thanks
David

david


wapperdude

I do very little programming, but here's what I've been able to discover.  It seems as though TreeView requires some Visual Basic support either Visual Basic.Net or Visual Basic 6 are the most likely approaches.  It doesn't seem like you can just plop the Control down as simply as with a shape.  There is more supplemental work required.   :o

You might try the following link as a starting point:  http://msdn.microsoft.com/en-us/library/ms747277.aspx

A general search link is:  http://search.msdn.microsoft.com/Default.aspx?query=treeview&brand=msdn&locale=en-us&refinement=

I believe the Visio 2007 SDK may have an example file regarding TreeView:  http://www.microsoft.com/downloads/details.aspx?FamilyId=373D34B8-5EF7-4E6E-A582-C8D6B5EE4E33&displaylang=en   :-\

I have a reference text at home on Visual Basic.Net if your interested.  It has a chapters on both TreeView and ListView, but it is not targetted for Visio.   :'(
Visio 2019 Pro

Visio Guy

Hi David,

You're kind of crossing worlds if you are trying to drag a shape into a TreeView control. You'll have to implement some drag and drop code to do this. There are plenty of examples on the web. Kind of neat problem, now that I think about it.

Besides people sometimes just not seeing a question, another reason you might not have gotten a response is this: the answer would be as long as a book. The question is too general and people are busy :)

As far as what version of a control to use, you might as well go with the newest!

From some quick tests, it looks like you'll need to set OLEDropMode = ccOLEDropManual. Then you'll have an event that can be handled on drop:

Private Sub TreeView1_OLEDragDrop(Data As MSComctlLib.DataObject, _
                                  Effect As Long, Button As Integer, _
                                  Shift As Integer, _
                                  x As Single, _
                                  y As Single)
 
  Debug.Print "Something was just dropped on the tree"
 
End Sub


You should somehow be able to get the Visio data from the Data argument, but I played with it for 15 minutes and couldn't find/remember how to get the Visio-specific data about what was dropped. There are Data.GetData and Data.GetFormat functions to do this, I just don't have time to work it out.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

david

thanks for your answer.
i'm sorry i didn't reply for a long time.  it was my exams period.  now it's over and i'm back to work on visio.
i really didn't mean that the answer will be as long as a book.  i just wanted a link or any reference that can help me study all the relevant functions/events of the treeview control.

wapperdude, thanks for the links but unfortunatelly they weren't very helpful.  all i could see was xml examples but i can use xml only for specific nodes (with specific names).  but i don't know ahead which forms the user will drag to the frame so i don't see how writing xml files will help me.  it should be written somewhere in the events code.

visio guy, the event you gave me (TreeView1_OLEDragDrop) was the same event i already tried before but i also couldn't do anything with it.  it really seems to be the event i should work with but unfortunatelly i have no idea how to work with that event and what to do with its paremeters.  i tried just to see what happens to write msgbox("hi") in that event but nothing happened when i dragged a form to the shape.  so i even don't know what exactly i should drag and drop in this event.

i'm not expecting for a long answer, just a link or even a book if needed that explains all the events of the treeview so i'll be able to start working on it.  i'll appreciate any help.

thanks in advance
David

david

btw, visio guy
i didn't understand what the code OLEDropMode = ccOLEDropManual means and where i should write it.