Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview
Message
De
21/05/2010 08:53:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
21/05/2010 05:01:48
Issam Mansour
Jordan Business Machines
Amman, Jordanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01465171
Message ID:
01465399
Vues:
57
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform