We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

During run-time we may be required to copy the content of a treeview into another treeview programmatically
 
Let us suppose there are two treeviews (treeview1 and treeview2)  and a button (button1)  in a form. In the button-click event one program file will be called which copies the content of treeview1 to treeview2.
Button-Click event:
 
 DO copytree WITH this.parent.treeview1, this.parent.treeview2
//This code calls a program file(copytree.prg) and passes two treeviews as a parameter
 
copytree.prg:
 
PARAMETERS objTVSrc, objTVDest

objTVDest.Nodes.Clear 
//Deletes all the nodes of the treeview1 before coping  
 
 For Each lonode In objTVSrc.Nodes
 
 WITH lonode
    If ISNULL(lonode.Parent) 
         objtvdest.nodes.Add(,1, .Key, .Text) 
         //adds root nodes to the treeview2
    ELSE
         objtvdest.nodes.add(.parent.key,4,.key,.text)
         // adds child nodes in treeview2
    EndIf
 ENDWITH

ENDFOR


Related Tags:

Visual FoxPro

Author: K.Hari Prasad

top

Related Pages

  • FoxPro Development India
  • FoxPro Development Projects

Miscellaneous

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login