Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TreeView control
Message
De
29/04/2003 03:47:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/04/2003 18:36:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00782511
Message ID:
00782589
Vues:
13
>Does anyone have code or an easy way to get the physical order of nodes in a TreeView control? (The order in which they appear from top to bottom even if not expanded.) I need to write the node names to a table that I can use to set up a report that groups and prints data in this order.
>
>Thanks in advance.

You could modify this to suit your needs.
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)
    Do While lnIndex # lnLastIndex
      lnIndex = .Nodes(lnIndex).Next.Index
      _GetSubNodes(lnIndex,toTV)
    Enddo
  Endwith
  Return _Cliptext

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


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

  With toTV
    lnRootIndex = .Nodes(lnIndex).Root.Index
    lcPrefix = '+-' + .Nodes(lnIndex).Text

    Do While lnIndex # lnRootIndex
      lnIndex = .Nodes(lnIndex).Parent.Index
      lcPrefix = Iif(.Nodes(lnIndex).LastSibling.Index = ;
         lnIndex,' ','|')+Space(3)+lcPrefix
    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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform