>I am working on the report for the dbfcompare utility by Wouter and I am trying to mimic the vertical lines in a treeview control. I have modified the project to store all of the treeview nodes to records in a table and it is printing exactly as it should as far as data is concerned.
>
>In the group header I display the table name and in the detail band I display first the table's fields and the field's properties and then the tags and their expressions. The fieldname and tagname fields are placed on top of each other in the report detail band and only print depending on a conditional statement (ctype=1 for field and ctype=2 for tag). This successfully displays all field properties first and then all tag properties for each table in the report. All data displays correctly.
>
>However, I'm trying to mimic the treeview control display in the report, and I would like to draw a vertical line that extends from the group header (table name) each detail line (field or tagname). The line draws correctly from the field in the group header and extends down to each detail line correctly EXCEPT when I reach the end of the group. The vertical line continues for a small portion when the end of the group is reached and the record pointer moves on to the first record for the next group (next tablename). I cannot get the vertical line to STOP at the last record in the group.
>
>Any ideas?
>
>TIA,
>Tracy
Tracy,
I have the idea but not implememtation :) For each node also keep an integer (assuming levels wouldn't go deeper than 32 levels). Using treeview control bitset the bits where a node is a child, grandchild, grandgrand.. of a node. For your vertical lines print when use an expression like :
bittest(lnThisNodelines, 12) - 13th vertical line should dipslay or not.
However I wrote a routine to list a treeview with ASCII chars (+ - |) and that might help you finding the missing point for the 'stop' - pls note that this was in fact a class but was easier for me to write as a series of funstions here :
StrToFile(TVLister(thisform.Treeview),'treeviewoutput.txt')
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
lnLevel = 0
Do While lnIndex # lnRootIndex
lnIndex = .Nodes(lnIndex).Parent.Index
lcPrefix = Iif(.Nodes(lnIndex).LastSibling.Index = ;
lnIndex,' ','|')+Space(3)+lcPrefix
lnLevel = lnLevel + 1
Enddo
_Cliptext = _Cliptext + lcPrefix + Chr(13)
Endwith
Cetin