Hi,
We wrote a simulated Tree way back in C6 when we were working on displaying tree structures on a control in an internet application. What we did was define a record with parent1_id, parent2_id, parent3_id ( as longs), etc for as many levels as you want. Make aliases of this file for use in recursion. Define a QUEUE and populate it from the file - use the file with paren1_id = 0 to display all of the primary elements. After that keep displaying successive children of that parent which have something like parent1_id = 2 and the next level will have parent3 = id of parent2 record. This can go on to as many levels as you want.
This takes some time and coding (especially to build and maintain the list of parents and children) but we built and used a very versatile simulated tree using line indents and icons.
I am building a similar one right now. Here is the primary file structrure:
P_PARTS FILE,DRIVER('TOPSPEED'),OWNER('rsj4149'),NAME(kpartsname),PRE(PPT),CREATE !Parts for Kiosks
FK_CATEGORY KEY(PPT:Category_IHID),DUP,NOCASE
SERIAL_KEY KEY(PPT:Kiosk_SerialNumber),DUP,NOCASE !Serial number
FK_INVENTORY KEY(PPT:Inventory_IHID),DUP,NOCASE !Foreign key to inventory
FK_REGISTRY KEY(PPT:K_REG_ID),DUP,NOCASE !FK to Kiosk registry
Level1_KEY KEY(PPT:Lev1ParentID),DUP,NOCASE
Level2_key KEY(PPT:Lev2ParentID),DUP,NOCASE
Level3_KEY KEY(PPT:Lev3ParentID),DUP,NOCASE
Level4_KEY KEY(PPT:Lev4ParentIHID),DUP,NOCASE
IHID_KEY KEY(PPT:IHID),PRIMARY,NAME('BRLS_IHID_KEY'),NOCASE
Name_KEY KEY(PPT:KioskID),DUP,NAME('BRLS_Name_KEY'),NOCASE
FK_MFGR KEY(PPT:Mfgr_ID),DUP,NOCASE !foreign key to manufacturer
fK_supplier KEY(PPT:Supplier_ID),DUP,NOCASE !foreign to supplier
record RECORD
IHID LONG
KioskID STRING(100) !kiosk ID
K_REG_ID LONG !kiosk registry IHID
Kiosk_SerialNumber CSTRING(20) !our serial number for build
Inventory_IHID LONG !if we inventory the parts this is the inventory ID number of the part
Category_IHID LONG
KioksLoc CSTRING(200)
Part STRING(51) !sub description
KBuildDate LONG
....
Part_MEMO CSTRING(1000)
Lev1ParentID LONG !level 1 parent ihid
Lev2ParentID LONG
Lev3ParentID LONG
Lev4ParentIHID LONG
levelNumber LONG
hasChildren BYTE ! you can use this to display in icon with a + if there are children
END
END
We have partsAlias, PartsAlias2, partsAlias3 which are all related to the parts file and this makes the recursion work!
Maybe that is an example of what you might want to do.
Ron