Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview
Message
From
21/05/2010 08:53:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
21/05/2010 05:01:48
Issam Mansour
Jordan Business Machines
Amman, Jordan
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01465171
Message ID:
01465399
Views:
56
>thank you Çetin,
>
>Is there any way to print the Microsoft treeview, I use to use the tlist7 to print the treeview.
>
>
>Best Regards

Yes,
You can walk the nodes and print. Here is a sample:

TVToClip(this.Tree)
*Function TVToClip
Lparameters toTV
  Local lnIndex,lnLastIndex
  _Cliptext=''
  With toTV
    lnIndex     = .Nodes(1).Root.FirstSibling.Index
    lnLastIndex = .Nodes(1).Root.LastSibling.Index
    _GetSubNodes(m.lnIndex,m.toTV,m.lnIndex)
    Do While m.lnIndex # m.lnLastIndex
      lnIndex = .Nodes(m.lnIndex).Next.Index
     _GetSubNodes(m.lnIndex,m.toTV,m.lnIndex)
    Enddo
  EndWith
  Return _Cliptext

Function _GetSubNodes
  Lparameters tnIndex, toTV, tnRootIndex
  Local lnIndex, lnLastIndex
  With m.toTV
    WriteNode(m.tnIndex,m.toTV, m.tnRootIndex)
    If .Nodes(m.tnIndex).Children > 0
      lnIndex  = .Nodes(m.tnIndex).Child.Index
      lnLastIndex = .Nodes(m.tnIndex).Child.LastSibling.Index
      _GetSubNodes(m.lnIndex,m.toTV,m.tnRootIndex)
      Do While m.lnIndex # m.lnLastIndex
        lnIndex = .Nodes(lnIndex).Next.Index
        _GetSubNodes(m.lnIndex,m.toTV,m.tnRootIndex)
      Enddo
    Endif
  Endwith

Function WriteNode
  Lparameters tnCurIndex, toTV,tnRootIndex
  Local lnRootIndex, lnIndex, lcPrefix, lcKey, lnLevel
  lnIndex = m.tnCurIndex

  With toTV
    lcPrefix = '+-' + .Nodes(m.lnIndex).Text
    lnLevel = 0
    Do While m.lnIndex # m.tnRootIndex
      lnIndex = .Nodes(m.lnIndex).Parent.Index
      lcPrefix = Iif(.Nodes(m.lnIndex).LastSibling.Index = m.lnIndex,' ','|')+Space(3)+m.lcPrefix
      lnLevel = m.lnLevel + 1
    EndDo
    _Cliptext = _Cliptext + m.lcPrefix + Chr(13)
  Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform