Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print of treeview
Message
From
24/03/2004 05:06:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00889129
Message ID:
00889152
Views:
19
>Hi,
>In my accounting software i have developed a tree view for showing different accounts in different groups, my client has asked for the printout of the same.
>what is the easiest way to print the treeview.
>please let me know asap.
>
>Thanking You.
>
>Riyaz Patanwala

Not perfect but works :
* Copies tree to clipboard
*Function TVLister 
Lparameters toTV
  Local lnIndex,lnLastIndex
  _Cliptext=''
  With toTV
    lnIndex     = .Nodes(1).Root.FirstSibling.Index
    lnLastIndex = .Nodes(1).Root.LastSibling.Index
    _GetSubNodes(lnIndex,toTV,lnIndex)
    Do While lnIndex # lnLastIndex
      lnIndex = .Nodes(lnIndex).Next.Index
     _GetSubNodes(lnIndex,toTV,lnIndex)
    Enddo
  Endwith
  Return _Cliptext

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

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

  With toTV
    lcPrefix = '+-' + .Nodes(lnIndex).Text
    lnLevel = 0
    Do While lnIndex # tnRootIndex
      lnIndex = .Nodes(lnIndex).Parent.Index
      lcPrefix = Iif(.Nodes(lnIndex).LastSibling.Index = lnIndex,' ','|')+Space(3)+lcPrefix
      lnLevel = lnLevel + 1
    EndDo
    _Cliptext = _Cliptext + 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