Douglas Sánchez Guillén
unread,Mar 4, 2012, 8:51:04 PM3/4/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to publice...@googlegroups.com
Hola yo tengo dos rutinas una para grafico y la otra para imprmir en texto simple.
para texto sinsilla es esta...
Tvlister () es la funcion
Thisform.testructura es el nodo yo en mi caso uso el de vbtofox.ocx es facil de controlar y los graficos que se pueden adjuntar son buenos.
Create Cursor TMPTREE (TEXTO C(100), Dir Int)
Select TMPTREE
Local TMP As Character
TMP = TVLister(Thisform.testructura) &&&& abajo esta la funcion espero te sirva, yo hago la estructura organizacion de la empresa y asi la imprimo.
**** imprimir Tree view
Function TVLister
Lparameters toTV
Local lnIndex,lnLastIndex
_Cliptext=''
With toTV
lnIndex = .Nodes(1).Root.FirstSibling.Index
lnLastIndex = .Nodes(1).Root.LastSibling.Index
_GetSubNodes(m.lnIndex,m.toTV,m.lnIndex)
Do While m.lnIndex # m.lnLastIndex
lnIndex = .Nodes(lnIndex).Next.Index
_GetSubNodes(m.lnIndex,m.toTV,m.lnIndex)
Enddo
Endwith
Return _Cliptext
Function _GetSubNodes
Lparameters tnIndex, toTV, tnRootIndex
Local lnIndex, lnLastIndex
With toTV
WriteNode(m.tnIndex,m.toTV, m.tnRootIndex)
If .Nodes(m.tnIndex).Children > 0
lnIndex = .Nodes(m.tnIndex).Child.Index
lnLastIndex = .Nodes(m.tnIndex).Child.LastSibling.Index
_GetSubNodes(m.lnIndex,m.toTV,m.tnRootIndex)
Do While m.lnIndex # m.lnLastIndex
lnIndex = .Nodes(lnIndex).Next.Index
_GetSubNodes(m.lnIndex,m.toTV,m.tnRootIndex)
Enddo
Endif
Endwith
Function WriteNode
Lparameters tnCurIndex, toTV,tnRootIndex
Local lnRootIndex, lnIndex, lcPrefix, lcKey, lnLevel
lnIndex = m.tnCurIndex
With toTV
lcPrefix = '+-> ' + .Nodes(m.lnIndex).Text
lnLevel = 0
Do While lnIndex # tnRootIndex
lnIndex = .Nodes(m.lnIndex).Parent.Index
lcPrefix = Iif(.Nodes(m.lnIndex).LastSibling.Index = m.lnIndex,' ','| ')+Space(3)+m.lcPrefix
lnLevel = m.lnLevel + 1
Enddo
Select TMPTREE
Append Blank
Replace texto With lcPrefix
_Cliptext = _Cliptext + m.lcPrefix + Chr(13)
Endwith