Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview Help
Message
 
To
23/09/2005 00:37:30
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01052278
Message ID:
01052295
Views:
8
This message has been marked as the solution to the initial question of the thread.
Tariq,
try this:
CREATE TABLE tree (node N(2),child n(2), detail c(50))
INSERT INTO tree (node, child, detail) VALUES (1 ,0,"Root")
INSERT INTO tree (node, child, detail) VALUES (2 ,1,"PAIDUP CAPITAL")
INSERT INTO tree (node, child, detail) VALUES (3 ,2,"Eric den Doop")
INSERT INTO tree (node, child, detail) VALUES (4 ,2,"Cetin Basoz")
INSERT INTO tree (node, child, detail) VALUES (5 ,1,"DIRECTORS ACCOUNTS")
INSERT INTO tree (node, child, detail) VALUES (6 ,5,"Sergy")
INSERT INTO tree (node, child, detail) VALUES (7 ,5,"Borislav Borissov")
INSERT INTO tree (node, child, detail) VALUES (8 ,1,"RESERVES")
INSERT INTO tree (node, child, detail) VALUES (9 ,8,"Profit & Loss b/f")
INSERT INTO tree (node, child, detail) VALUES (10,8,"Profit & Loss last year")

INDEX ON STR(child,5)+STR(node,5) TAG tree

thisform.LockScreen = .t.
o = ThisForm.oleTree
SELECT tree
GO TOP

SCAN
   IF tree.child = 0
      oNode           = o.nodes.add(,1,ALLTRIM(STR(tree.node))+"_",ALLTRIM(tree.detail),,)
      oNode.ForeColor = RGB(128,0,128)
      thisform.oleTree.SelectedItem = oNode
   ELSE
      oNode           = o.nodes.add(ALLTRIM(STR(tree.child))+"_",4,ALLTRIM(STR(tree.node))+"_", ALLTRIM(tree.detail),,)
   ENDIF
   IF tree.child # 0
      oNode.ForeColor = RGB(0,0,255)
   ENDIF
   oNode.Expanded  = .t.

ENDSCAN   
thisform.LockScreen = .f.
USE
>Dear Experts
>
>I want to show data in Treeview look like this
>
>1+PAID UP CAPITAL
>1- Eric den Doop
>2- Cetin Basoz
>2+DIRECTOR'S ACCOUNTS
>1- Sergy
>1- Borislav Borissov
>3+RESERVES
>1- Profit & Loss b/f
>1- Profit & Loss last year
>
>and for data I have following table entitled "Tree"
>
>
>CREATE TABLE tree (node N(2),child n(2), detail c(50))
>INSERT INTO tree (node, child, detail) VALUES (1,0,"PAIDUP CAPITAL")
>INSERT INTO tree (node, child, detail) VALUES (1,1,"Eric den Doop")
>INSERT INTO tree (node, child, detail) VALUES (1,2,"Cetin Basoz")
>INSERT INTO tree (node, child, detail) VALUES (2,0,"DIRECTORS ACCOUNTS")
>INSERT INTO tree (node, child, detail) VALUES (2,1,"Sergy")
>INSERT INTO tree (node, child, detail) VALUES (2,2,"Borislav Borissov")
>INSERT INTO tree (node, child, detail) VALUES (3,0,"RESERVES")
>INSERT INTO tree (node, child, detail) VALUES (3,1,"Profit & Loss b/f")
>INSERT INTO tree (node, child, detail) VALUES (3,2,"Profit & Loss last year")
>
>
>What should be the source codes to fullfil the purpose?
>
>Please help
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Previous
Reply
Map
View

Click here to load this message in the networking platform