Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need a grid to show parent-child relationship
Message
From
02/05/2008 14:49:50
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01314635
Message ID:
01314843
Views:
15
Steve

What I did was showing the child in different color, it was OK for a demo but your example gave me an idea that might meet the requirements.
I believe adding an extra column to the grid left side where it will be empty for a child and have a plus for the parent or some visual indications.
In other word, I can show the grid as in the expand mode but the only limit is that they can not collapse it which not critical for what I need.

Thanks

>Mo,
>
>I asked because of the way you posed the question. I was unsure if you knew about the VFP way to do it and perferred to find another control.
>
>Try this and see if it meets your needs. I use a browse statement in the example but it works in a grid as well.
>
>CREATE CURSOR PTAble (PID I, PName C(50))
>CREATE CURSOR CTAble (CID I, PID I, CName C(50))
>
>SELECT PTAble
>APPEND BLANK
>REPLACE PID WITH 1, PName WITH "Parent 1"
>APPEND BLANK
>REPLACE PID WITH 2, PName WITH "Parent 2"
>APPEND BLANK
>REPLACE PID WITH 3, PName WITH "Parent 3"
>
>
>SELECT CTAble
>APPEND BLANK
>REPLACE CID WITH 1, PID WITH 1, CName WITH "Child 1"
>APPEND BLANK
>REPLACE CID WITH 2, PID WITH 1, CName WITH "Child 2"
>APPEND BLANK
>REPLACE CID WITH 3, PID WITH 1, CName WITH "Child 3"
>
>APPEND BLANK
>REPLACE CID WITH 4, PID WITH 2, CName WITH "Child 4"
>APPEND BLANK
>REPLACE CID WITH 5, PID WITH 2, CName WITH "Child 5"
>APPEND BLANK
>REPLACE CID WITH 6, PID WITH 2, CName WITH "Child 6"
>
>APPEND BLANK
>REPLACE CID WITH 7, PID WITH 3, CName WITH "Child 7"
>APPEND BLANK
>REPLACE CID WITH 8, PID WITH 3, CName WITH "Child 8"
>APPEND BLANK
>REPLACE CID WITH 9, PID WITH 3, CName WITH "Child 9"
>
>SELECT CTAble
>INDEX ON PID TAG PID
>
>SELECT PTAble
>SET RELATION TO pid INTO Ctable ADDITIVE
>SET SKIP TO Ctable
>GO TOP
>BROWSE FIELDS PTable.pid, PTable.PName, CTable.cid, CTable.cname
Previous
Reply
Map
View

Click here to load this message in the networking platform