FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Cargar Treeview desde un archivo jerarquizado
Posts: 99
Joined: Thu Aug 02, 2012 03:21 PM
Cargar Treeview desde un archivo jerarquizado
Posted: Wed Feb 06, 2013 06:20 PM
Saludos amigos foristas, les pido ayuda para ver como enfrentar este procedimiento, tengo un archivo con una estructura jerarquica donde tengo identificado en orden consecutivo la estructura y su profundidad (depth).
Code (fw): Select all Collapse
 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 NAME 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 DEPTH
======================================================================================== 聽=====
VISUALIZAR 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽0
聽 聽ESTABLECER LOS OBJETIVOS Y PROP脫SITOS DEL PROYECTO 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 1
聽 聽 聽 1. Establecer los objetivos y prop贸sitos del proyecto 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 2
聽 聽 聽 聽 聽 A. Conformar el equipo de trabajo de la fase visualizar 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 聽 聽 B. Planificar fase visualizar 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 聽 聽 C. Preparar y convocar reuni贸n mesa de trabajo No.1 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 聽 聽 D. Establecer productos y vol煤menes de producci贸n 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 聽 聽 E. Establecer calidad de los productos 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 F. Establecer alimentaci贸n requerida (volumen y calidad) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 G. Premisas consideradas para establecer objetivos y Prop贸sitos del proyecto 聽 聽 聽3
聽 聽 聽 聽 聽 H. Establecer requerimientos de prueba/ investigaci贸n adicional para verificar 聽 聽3
聽 聽 聽 聽 聽 I. Establecer dependencias y relaci贸n con otros proyectos del plan 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽VERIFICAR ALINEACI脫N DEL PROYECTO CON ESTRATEGIA CORPORATIVA 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 1
聽 聽 聽 1. Verificar alineaci贸n del proyecto con estrategia corporativa 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 2
聽 聽 聽 聽 聽 A. Conocer lineamientos y requerimientos del portafolio de oportunidades y/o 聽 聽 聽3
聽 聽 聽 聽 聽 B. Identificar oportunidades de optimizaci贸n de infraestructuras 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 C. Documentar la identificaci贸n de alineaci贸n del proyecto con los objetivos 聽 聽 聽3
聽 聽DESARROLLO PRELIMINAR DEL PROYECTO 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 1
聽 聽 聽 1. Elaborar alcance preliminar del proyecto: 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽2
聽 聽 聽 聽 聽 A. Recopilar 聽informaciOn requerida 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 聽 聽 B. Identificar requerimientos de infraestructura y servicios 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 C. Establecer factibilidad t脙漏cnica del proyecto 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 D. Documentar alcance preliminar del proyecto 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 2. Elaborar de costo Clase V 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽2
聽 聽 聽 聽 聽 A. Recopilar informaci贸n requerida 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 B. Seleccionar metodolog脙卢a de estimaci贸n 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 聽 聽 C. Elaboraci贸n de estimado de Clase V del proyecto, que incluya estimado Clase 聽 聽3
聽 聽 聽 3. Elaborar PEP Clase 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 2
聽 聽 聽 聽 聽 A. Describir premisas a c0nsiderar para la programaci贸n del proyecto 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 B. Identificar potenciales riesgos de incumplimiento 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 C. Establecer estrategias de ejecuci贸n 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 D. Establecer cronograma para el desarrollo de los hitos principales de ejecuc 聽 聽3
聽 聽 聽 聽 聽 E. Elaborar PEP Clase V del proyecto 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 F. 聽Recursos requeridos para ejecutar la fase conceptualizar 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 G. Elaborar Plan de ejecuci贸n Clase II de la fase conceptualizar 聽 聽 聽 聽 聽 聽 聽 聽 聽3
聽 聽 聽 4. Describir factibilidad del proyecto (t茅cnica y econ贸mica) 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽2
聽 聽 聽 聽 聽 A. Describir par脙隆metros de prefactibilidad econ贸mica del Paquete que contiene 聽 聽3
聽 聽 聽 聽 聽 B. Lista de riesgos mayores/ identificaci贸n preliminar de peligros SHA 聽 聽 聽 聽 聽 聽3
聽 聽 聽 聽 聽 C. Preparar y convocar reuni贸n mesa de trabajo No.2 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 3
聽 聽 聽 聽 聽 D. Someter DSD1 y solicitar fondos para la fase conceptualizar 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽3


teniendo estos datos ya organizados, elabor茅 una funci贸n que construye el tree, sin embargo la l贸gica que utilice no es la m谩s idonea.
Esta es la funci贸n.
Code (fw): Select all Collapse
Function BuildTree( oTree, aItems, cTreeName )
聽 聽 聽 聽 聽LOCAL oItem0, oItem1, oItem2, oItem3, oItem4, oItem5, oItem6, oItem7, oItem8, oItem9
聽 聽 聽 聽 聽LOCAL n
聽 聽 聽 聽 聽LOCAL nPrevLevel := aItems[1][2]
聽 聽 聽 聽 聽Local nImg := 0
聽 聽 聽 聽 聽LOCAL nItems := LEN( aItems )
聽 聽 聽 聽 聽FOR n := 1 TO nItems
聽 聽 聽 聽 聽 聽 聽DO CASE
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 0
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem0 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem0 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem0 := oTree:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem0:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 1
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem1 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem1 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem1 := oItem0:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem1:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 2
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem2 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem2 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem2 := oItem1:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem2:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 3
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem3 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem3 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem3 := oItem2:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem3:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 4
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem4 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem4 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem4 := oItem3:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem4:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 5
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem5 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem5 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem5 := oItem4:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem5:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 6
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem6 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem6 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem6 := oItem5:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem6:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 7
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽MsgInfo( STR(n)+CRLF+aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem7 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem7 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem7 := oItem6:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem7:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 8
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem8 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem8 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem8 := oItem7:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem7:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 CASE aItems[n][2] == 9
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF aItems[n][2] < nPrevLevel
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem9 := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF oItem9 == NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem9 := oItem8:Add( aItems[n][1] )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ELSE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oItem9:Add( aItems[n][1] ) 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ENDIF
聽 聽 聽 聽 聽 聽 聽ENDCASE
聽 聽 聽 聽 聽 聽 聽nPrevLevel := aItems[n][2]
聽 聽 聽 聽 NEXT n


Quien puede ayudar con una funci贸n que considere por lo menos diez subniveles en la estructura.
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)

FiveWin Version: FWHX 15.01

BCC 5.8.2
Posts: 99
Joined: Thu Aug 02, 2012 03:21 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Thu Feb 07, 2013 06:19 PM

Alguien tiene alguna idea?

Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)

FiveWin Version: FWHX 15.01

BCC 5.8.2
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Thu Feb 07, 2013 06:47 PM

Buenas tardes
Si lo que buscas es 煤nicamente a nivel de presentaci贸n visual, quiz谩s te sirva algo parecido a:
aITems[][] := Space( 3 * nDepth )+" "+aITems[][]
Y despu茅s cargar la tabla en un browse sin necesidad de realizar un Tree
Un saludo

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Thu Feb 07, 2013 09:41 PM

Herbert,

En FWH/samples/ClassTree.prg tienes un ejemplo de como ir a帽adiendo ramas hijas a un tree, sin l铆mite de subniveles

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Fri Feb 08, 2013 12:08 AM
Herbert

Te dejo un ejemplo a raiz de la informacion que publicaste

Code (fw): Select all Collapse
#include "fivewin.ch"

function main()
    local aData, oWnd, oTree

    aData = {;
{"VISUALIZAR",0},;
{"ESTABLECERLOSOBJETIVOSYPROP脫SITOSDELPROYECTO",1},;
{"1.Establecerlosobjetivosyprop贸sitosdelproyecto",2},;
{"A.Conformarelequipodetrabajodelafasevisualizar",3},;
{"B.Planificarfasevisualizar",3},;
{"C.Prepararyconvocarreuni贸nmesadetrabajoNo.1",3},;
{"D.Establecerproductosyvol煤menesdeproducci贸n",3},;
{"E.Establecercalidaddelosproductos",3},;
{"F.Estableceralimentaci贸nrequerida(volumenycalidad)",3},;
{"G.PremisasconsideradasparaestablecerobjetivosyProp贸sitosdelproyecto",3},;
{"H.Establecerrequerimientosdeprueba/investigaci贸nadicionalparaverificar",3},;
{"I.Establecerdependenciasyrelaci贸nconotrosproyectosdelplan",3},;
{"VERIFICARALINEACI脫NDELPROYECTOCONESTRATEGIACORPORATIVA",1},;
{"1.Verificaralineaci贸ndelproyectoconestrategiacorporativa",2},;
{"A.Conocerlineamientosyrequerimientosdelportafoliodeoportunidadesy/o",3},;
{"B.Identificaroportunidadesdeoptimizaci贸ndeinfraestructuras",3},;
{"C.Documentarlaidentificaci贸ndealineaci贸ndelproyectoconlosobjetivos",3},;
{"DESARROLLOPRELIMINARDELPROYECTO",1},;
{"1.Elaboraralcancepreliminardelproyecto:",2},;
{"A.RecopilarinformaciOnrequerida",3},;
{"B.Identificarrequerimientosdeinfraestructurayservicios",3},;
{"C.Establecerfactibilidadt脙漏cnicadelproyecto",3},;
{"D.Documentaralcancepreliminardelproyecto",3},;
{"2.ElaborardecostoClaseV",2},;
{"A.Recopilarinformaci贸nrequerida",3},;
{"B.Seleccionarmetodolog脙卢adeestimaci贸n",3},;
{"C.Elaboraci贸ndeestimadodeClaseVdelproyecto,queincluyaestimadoClase",3},;
{"3.ElaborarPEPClase",2},;
{"A.Describirpremisasac0nsiderarparalaprogramaci贸ndelproyecto",3},;
{"B.Identificarpotencialesriesgosdeincumplimiento",3},;
{"C.Establecerestrategiasdeejecuci贸n",3},;
{"D.Establecercronogramaparaeldesarrollodeloshitosprincipalesdeejecuc",3},;
{"E.ElaborarPEPClaseVdelproyecto",3},;
{"F.Recursosrequeridosparaejecutarlafaseconceptualizar",3},;
{"G.ElaborarPlandeejecuci贸nClaseIIdelafaseconceptualizar",3},;
{"4.Describirfactibilidaddelproyecto(t茅cnicayecon贸mica)",2},;
{"A.Describirpar脙隆metrosdeprefactibilidadecon贸micadelPaquetequecontiene",3},;
{"B.Listaderiesgosmayores/identificaci贸npreliminardepeligrosSHA",3},;
{"C.Prepararyconvocarreuni贸nmesadetrabajoNo.2",3},;
{"D.SometerDSD1ysolicitarfondosparalafaseconceptualizar",3};
}
    


    define window oWnd
        oTree = TTreeView():New( 0, 0, oWnd,,,,,400,400,,.t.)

        BuildTree(oTree, aData)
    activate window oWnd


return nil

function BuildTree( uObj, aData ) 

   local oItem := uObj
   local oSubItem, item, oParent, i
   
   for each item in aData
      if item[2] > 0
        if item[2] > oSubItem:Cargo["level"]
           oItem = oSubItem
        elseif item[2] == oSubItem:Cargo["level"]
            oItem = oSubItem:oParent
        else
           oParent = oSubItem:oParent
           for i = oSubItem:Cargo["level"] to item[2] + 1 step -1
              oParent = oParent:oParent
           next
           oItem = oParent
        endif
      endif
      oSubItem = oItem:Add(item[1])
      oSubItem:Cargo = { "level" => item[2] }
   next

return nil
Posts: 99
Joined: Thu Aug 02, 2012 03:21 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Fri Feb 08, 2013 02:07 PM
Muchas gracias,

Buenas tardes
Si lo que buscas es 煤nicamente a nivel de presentaci贸n visual, quiz谩s te sirva algo parecido a:
aITems[][] := Space( 3 * nDepth )+" "+aITems[][]
Y despu茅s cargar la tabla en un browse sin necesidad de realizar un Tree
Un saludo
Cristobal Navarro


Si amigo Cristobal, de hecho asi lo tengo, pero necesitamos mostrar el tree para realizar la edici贸n del mismo.

Herbert,

En FWH/samples/ClassTree.prg tienes un ejemplo de como ir a帽adiendo ramas hijas a un tree, sin l铆mite de subniveles
regards, saludos

Antonio Linares
http://www.fivetechsoft.com


Antonio, ya he revisado los samples, el detalle es que la estructura yo no la tengo predefinida, el usuario la crea y la almacena en la base de datos, utilizando el modelo de lista adyacente (Adjacency List Model) en MYSQL, cuando hago la consulta o QUERY, obtengo la estructura en el formato (nombre, nivel-subtree).

Amigo Daniel voy a probar lo que tu enviastes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)

FiveWin Version: FWHX 15.01

BCC 5.8.2
Posts: 99
Joined: Thu Aug 02, 2012 03:21 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Fri Feb 08, 2013 02:52 PM
Daniel, cuando llega al elemento n煤mero 4 del arreglo da este fallo.

Application
===========
Path and name: C:\FWH\samples\treedaniel.exe (32 bits)
Size: 1,301,504 bytes
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 02/08/13, 10:19:17
Error description: Error BASE/1004 Class: 'NIL' has no exported method: ADD
Args:
[ 1] = U
[ 2] = C B.Planificarfasevisualizar

Stack Calls
===========
Called from: => ADD(0)
Called from: treedaniel.prg => BUILDTREE(81)
Called from: treedaniel.prg => MAIN(55)

System
======
CPU type: Genuine Intel(R) CPU U2500 @ 1.20GHz 1200 Mhz
Hardware memory: 1016 megs

Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %

Compiler version: xHarbour build 1.1.0 Intl. (SimpLex)
Windows version: 5.1, Build 2600 Service Pack 2

Windows total applications running: 0

Variables in use
================
Procedure Type Value
==========================
ADD
Param 1: C "B.Planificarfasevisualizar"
Local 1: A Len: 1
Local 2: U
Local 3: N 0
BUILDTREE
Param 1: O Class: TTREEVIEW
Param 2: A Len: 40
Local 1: U
Local 2: O Class: TTVITEM
Local 3: A Len: 2
Local 4: U
Local 5: U
MAIN
Local 1: A Len: 40
Local 2: O Class: TWINDOW
Local 3: O Class: TTREEVIEW

Linked RDDs
===========
DBF
DBFFPT
DBFBLOB
DBFNTX

DataBases in use
================

Classes in use:
===============
1 HASHENTRY
2 HBCLASS
3 HBOBJECT
4 TWINDOW
5 TBRUSH
6 TFONT
7 TCONTROL
8 TTREEVIEW
9 TTVITEM
10 ERROR
11 TREG32

Memory Analysis
===============
92 Static variables

Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)

FiveWin Version: FWHX 15.01

BCC 5.8.2
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Fri Feb 08, 2013 03:28 PM
Herbert


a mi me funciona perfectamente

te dejo el link de descarga del zip que contiene un EXE y el PRG

http://sitasoft.net/fivewin/samples/herbert.zip
Posts: 99
Joined: Thu Aug 02, 2012 03:21 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Tue Feb 26, 2013 02:10 PM

Buen dia daniel, te envie un correo para ver si me puedes ayudar.

Saludos,

Hebert

Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)

FiveWin Version: FWHX 15.01

BCC 5.8.2
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Tue Feb 26, 2013 05:53 PM

Herbert

listo enviado los cambios necesarios para que lo puedas usar en la version de fivewin que usas

Posts: 99
Joined: Thu Aug 02, 2012 03:21 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Wed Feb 27, 2013 08:54 PM

Gracias hermano, ahora si funciona!!!

Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)

FiveWin Version: FWHX 15.01

BCC 5.8.2
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: Cargar Treeview desde un archivo jerarquizado
Posted: Sun May 30, 2021 12:04 PM

y partiendo desde el tree como llegas a ese array?
Estoy intentando rearmarlo pero no logro hacerlo.

FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/

Continue the discussion