Error de pintado Treeview

Re: Error de pintado Treeview

Postby Antonio Linares » Fri Aug 22, 2014 4:09 am

Victor,

En este array:

Code: Select all  Expand view
LOCAL aData:= {{"Unidades Virtuales",      0, 0, Nil},;
                 {"Disco 3 1.44 Mb",       1, 1, Nil},;
                   {"Volumen 15151441",    2, 2, "uno"},;
                   {"Volumen 84515158",    2, 2, "dos"},;
                   {"Volumen 77722582",    2, 2, "tres"},;
                   {"Volumen 15151441",    2, 2, "cuatro"},;
                   {"Volumen 84515158",    2, 2, "cinco"},;
                   {"Volumen 77722582",    2, 2, "seis"},;
                 {"Discos Duros",          1, 3, Nil},;
                   {"Volumen 1",           2, 4, Nil},;
                   {"Particion 1",         3, 2, "siete"},;
                   {"Particion 2",         3, 2, "ocho"},;
                   {"Particion 3",         3, 2, "nueve"},;
                   {"Volumen 2",           2, 4, Nil},;
                   {"Particion 1",         3, 2, "diez"},;
                   {"Particion 2",         3, 2, "once"},;
                 {"Disco CD-DVD RAM",      1, 5, Nil},;
                   {"Volumen 15151441",    2, 2, "doce"},;
                   {"Volumen 45481278",    2, 2, "trece"},;
                   {"Volumen 89612255",    2, 2, "catorce"},;
                 {"Unidades Virtuales RAM",1, 6, Nil},;
                   {"Volumen 15151441",    2, 2, "quince"},;
                   {"Volumen 45481278 Haber si funciona el Scroll",    2, 2, "diesiseis"},;
                   {"Volumen 89612255",    2, 2, "diesisiete"},;
                 {"Unidades de Red",       1, 7, Nil},;
                   {"Volumen 45481278",    2, 2, "diesiocho"},;
                 {"Discos USB",            1, 8, Nil},;
                   {"Volumen 1",           2, 2, "diesinueve"},;
                   {"Volumen 2",           2, 2, "veinte"}}


Entiendo que la primera columna de números es para saber a que nivel esta "indentado", y la segunda columna es ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error de pintado Treeview

Postby Antonio Linares » Fri Aug 22, 2014 4:10 am

Para que necesitas la segunda columna ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error de pintado Treeview

Postby Antonio Linares » Fri Aug 22, 2014 4:20 am

Visto, ok, es el bitmap a usar.

Aqui lo tienes funcionando correctamente :-)

Code: Select all  Expand view
# Include "FiveWin.ch"
     
FUNCTION Main()
  ExploDsk()
RETURN Nil


   
FUNCTION ExploDsk()
   
LOCAL oLogo,oCur,oSel,oIco,oDlg,oBtn1,oBtn2,oTree,oFont1,oFont2,oImageList

    DEFINE FONT        oFont1        NAME     "TAHOMA"    BOLD SIZE 00, 16
    DEFINE FONT        oFont2        NAME     "TAHOMA"         SIZE 00, 16
    DEFINE CURSOR      oCur          RESOURCE "FLECHA"
    DEFINE CURSOR      oSel          RESOURCE "MANO"
    DEFINE ICON        oIco          RESOURCE "00"
    DEFINE DIALOG      oDlg          RESOURCE "LISTADO"  TITLE "Listado de Discos" ICON oIco
 
   oImageList := TImageList():New(24,24)            
 
   oImageList:Add(TBitmap():DEFINE("VIR1",,oDlg), TBitmap():DEFINE("VIR2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("FLO1",,oDlg), TBitmap():DEFINE("FLO2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("PAR1",,oDlg), TBitmap():DEFINE("PAR2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("HDD1",,oDlg), TBitmap():DEFINE("HDD2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("INT1",,oDlg), TBitmap():DEFINE("INT2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("DVD1",,oDlg), TBitmap():DEFINE("DVD2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("RAM1",,oDlg), TBitmap():DEFINE("RAM2",,oDlg))  
   oImageList:Add(TBitmap():DEFINE("NET1",,oDlg), TBitmap():DEFINE("NET2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("USB1",,oDlg), TBitmap():DEFINE("USB2",,oDlg))
   
   
   
                                   
   oTree:= TTreeView():REDEFINE(100, oDlg, 0, , .F. ,"" )
   oTree:oFont:= oFont1
   oTree:OnClick:=  {| nRow,  nCol | oTree:Refresh() }
   oTree:bChanged:= {| oTree, oItem| oItem:= oTree:GetSelected(), ;
                       MsgInfo( oItem:cargo ) }
 
   oDlg:lHelpIcon:= .F.
   
   ACTIVATE DIALOG     oDlg          CENTERED   ON INIT(Self, Carga(oTree,oImageList,oFont2))

RETURN Nil


STATIC FUNCTION Carga(oTree,oImageList,oFont2)

LOCAL oRaiz, oNivel1, oItem, item
LOCAL aData:= {{"Unidades Virtuales",      0, 0, Nil},;
                 {"Disco 3 1.44 Mb",       1, 1, Nil},;
                   {"Volumen 15151441",    2, 2, "uno"},;
                   {"Volumen 84515158",    2, 2, "dos"},;
                   {"Volumen 77722582",    2, 2, "tres"},;
                   {"Volumen 15151441",    2, 2, "cuatro"},;
                   {"Volumen 84515158",    2, 2, "cinco"},;
                   {"Volumen 77722582",    2, 2, "seis"},;
                 {"Discos Duros",          1, 3, Nil},;
                   {"Volumen 1",           2, 4, Nil},;
                   {"Particion 1",         3, 2, "siete"},;
                   {"Particion 2",         3, 2, "ocho"},;
                   {"Particion 3",         3, 2, "nueve"},;
                   {"Volumen 2",           2, 4, Nil},;
                   {"Particion 1",         3, 2, "diez"},;
                   {"Particion 2",         3, 2, "once"},;
                 {"Disco CD-DVD RAM",      1, 5, Nil},;
                   {"Volumen 15151441",    2, 2, "doce"},;
                   {"Volumen 45481278",    2, 2, "trece"},;
                   {"Volumen 89612255",    2, 2, "catorce"},;
                 {"Unidades Virtuales RAM",1, 6, Nil},;
                   {"Volumen 15151441",    2, 2, "quince"},;
                   {"Volumen 45481278 Haber si funciona el Scroll",    2, 2, "diesiseis"},;
                   {"Volumen 89612255",    2, 2, "diesisiete"},;
                 {"Unidades de Red",       1, 7, Nil},;
                   {"Volumen 45481278",    2, 2, "diesiocho"},;
                 {"Discos USB",            1, 8, Nil},;
                   {"Volumen 1",           2, 2, "diesinueve"},;
                   {"Volumen 2",           2, 2, "veinte"}}

   
FOR Each Item In aData
  do case
     case Item[ 2 ] == 0
        oRaiz = oTree:Add( Item[ 1 ], Item[ 3 ] )
       
     case Item[ 2 ] == 1
        oNivel1 = oRaiz:Add( Item[ 1 ], Item[ 3 ] )  
       
     otherwise
        oItem = oNivel1:Add( Item[ 1 ], Item[ 3 ] )
        oItem:Cargo = Item[ 4 ]  
       
  endcase
next

oTree:SetImageList(oImageList)
oTree:Expand()
oTree:GoTop()


RETURN Nil

STATIC FUNCTION LeeSerie(cSerie)
MSGInfo(cSerie)
RETURN Nil
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error de pintado Treeview

Postby cuatecatl82 » Fri Aug 22, 2014 12:19 pm

Gracias Maestro Linares:

Funciona Perfecto Ayer ya no pude revisarle nada porque estuve fuera de la ciudad, pero lo acabo de probar yes lo que necesito..

Le envio los bitmaps con los nombres como me los solicito junto al archivo fuente para que este en los ejemplos de FW..

https://www.mediafire.com/?05gt8imgqt9rk53

De nuevo gracias..
Soluciones y Diseño de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Diseñador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
User avatar
cuatecatl82
 
Posts: 625
Joined: Wed Mar 14, 2007 6:49 pm
Location: San Cristobal de las Casas, Chiapas México

Re: Error de pintado Treeview

Postby Antonio Linares » Fri Aug 22, 2014 3:07 pm

Victor,

Gracias por los bitmaps y por el ejemplo :-)

Me alegro de que quedase solucionado :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error de pintado Treeview

Postby Antonio Linares » Fri Aug 22, 2014 3:23 pm

Añadido el ejemplo a los ejemplos de FWH :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error de pintado Treeview

Postby cuatecatl82 » Fri Aug 22, 2014 9:27 pm

Maestro Antonio:

Una corrección al ejemplo, en las modificaciones que me envio no esta armando correctamente el árbol jerarquizado cuando hay más Items padres a agregar:

Image

Para arreglar el fallo hize unas correcciones, sería importante que se cambiara el archivo que le envie anteriormente para el ejemplo de Fivewin por este:

Code: Select all  Expand view
# Include "FiveWin.ch"
     
FUNCTION Main()
  ExploDsk()
RETURN Nil


   
FUNCTION ExploDsk()
   
LOCAL oIco,oDlg,oTree,oFont1,oImageList

    DEFINE FONT        oFont1        NAME     "TAHOMA"    BOLD SIZE 00, 16
    DEFINE ICON        oIco          RESOURCE "00"
    DEFINE DIALOG      oDlg          RESOURCE "LISTADO"  TITLE "Listado de Discos" ICON oIco
 
   oImageList := TImageList():New(24,24)            
 
   oImageList:Add(TBitmap():DEFINE("VIR1",,oDlg), TBitmap():DEFINE("VIR2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("FLO1",,oDlg), TBitmap():DEFINE("FLO2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("PAR1",,oDlg), TBitmap():DEFINE("PAR2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("HDD1",,oDlg), TBitmap():DEFINE("HDD2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("INT1",,oDlg), TBitmap():DEFINE("INT2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("DVD1",,oDlg), TBitmap():DEFINE("DVD2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("RAM1",,oDlg), TBitmap():DEFINE("RAM2",,oDlg))  
   oImageList:Add(TBitmap():DEFINE("NET1",,oDlg), TBitmap():DEFINE("NET2",,oDlg))
   oImageList:Add(TBitmap():DEFINE("USB1",,oDlg), TBitmap():DEFINE("USB2",,oDlg))
   
   
   
                                   
   oTree:= TTreeView():REDEFINE(100, oDlg, 0, , .F. ,"" )
   oTree:oFont:= oFont1
   oTree:bChanged:= {| oTree, oItem| oItem:= oTree:GetSelected(), ;
                       IF(!EMPTY(oItem:cargo),(LeeSerie( oItem:cargo )),(SysRefresh())) }
 
   oDlg:lHelpIcon:= .F.
   
   ACTIVATE DIALOG     oDlg          CENTERED   ON INIT(Self, Carga(oTree,oImageList))

RETURN Nil


STATIC FUNCTION Carga(oTree,oImageList)

LOCAL Item, oNivel1, oRaiz, oItem
LOCAL lSub:= .F.
LOCAL lFin:= .F.
LOCAL aData:= {{"Unidades Virtuales",      0, 0, Nil},;
                 {"Disco 3 1.44 Mb",       1, 1, Nil},;
                   {"Volumen 15151441",    2, 2, "uno"},;
                   {"Volumen 84515158",    2, 2, "dos"},;
                   {"Volumen 77722582",    2, 2, "tres"},;
                   {"Volumen 15151441",    2, 2, "cuatro"},;
                   {"Volumen 84515158",    2, 2, "cinco"},;
                   {"Volumen 77722582",    2, 2, "seis"},;
                 {"Discos Duros",          1, 3, Nil},;
                   {"Volumen 1",           9, 4, Nil},;
                   {"Particion 1",         3, 2, "siete"},;
                   {"Particion 2",         3, 2, "ocho"},;
                   {"Particion 3",         3, 2, "nueve"},;
                   {"Volumen 2",           9, 4, Nil},;
                   {"Particion 1",         3, 2, "diez"},;
                   {"Particion 2",         3, 2, "once"},;
                 {"Disco CD-DVD RAM",      1, 5, Nil},;
                   {"Volumen 15151441",    2, 2, "doce"},;
                   {"Volumen 45481278",    2, 2, "trece"},;
                   {"Volumen 89612255",    2, 2, "catorce"},;
                 {"Unidades Virtuales RAM",1, 6, Nil},;
                   {"Volumen 15151441",    2, 2, "quince"},;
                   {"Volumen 45481278 Haber si funciona el Scroll",    2, 2, "diesiseis"},;
                   {"Volumen 89612255",    2, 2, "diesisiete"},;
                 {"Unidades de Red",       1, 7, Nil},;
                   {"Volumen 45481278",    2, 2, "diesiocho"},;
                 {"Discos USB",            1, 8, Nil},;
                   {"Volumen 1",           2, 2, "diesinueve"},;
                   {"Volumen 2",           2, 2, "veinte"}}

   
FOR Each Item In aData     // Agradecimiento a Antobio Linares por la Revisión
                           // 21 Agosto 2014
  DO CASE
     CASE Item[ 2 ] == 0
        oRaiz:= oTree:Add( Item[ 1 ], Item[ 3 ] )
       
     CASE Item[ 2 ] == 1
        oNivel1:= oRaiz:Add( Item[ 1 ], Item[ 3 ] )  
       
     CASE Item[ 2 ] == 9                      // SOLDISOFT Software Víctor Daniel Cuatecatl León
     IF lFin == .T. .AND. lSub == .T.         // Mejora para agregar Sub-Item Correcto.. 22 Agosto 2014
        oNivel1:= oNivel1:oParent
        lFin:= .F.
     ENDIF
     
        oNivel1:= oNivel1:Add( Item[ 1 ], Item[ 3 ] )
           lSub:= .T.
     
     OTHERWISE
        oItem:= oNivel1:Add( Item[ 1 ], Item[ 3 ] )
        oItem:Cargo:= {Item[ 4 ],Item[ 1 ]}
             
              IF lSub == .T. .AND. Item[ 2 ] == 9 .AND. Item[ 2 ] <= 3
                 oNivel1:= oNivel1:oParent                
                 lSub:= .F.
              ENDIF
        lFin:= .T.      
  ENDCASE
         
NEXT

oTree:SetImageList(oImageList)
oTree:Expand()
oTree:GoTop()


RETURN Nil

STATIC FUNCTION LeeSerie(aSerie)
MSGStop("Ejecutando -> " + aSerie[1],aSerie[2])
RETURN Nil


FUNCTION IsAppThemed()
RETURN .F.
 


Código Totalmente depurado sin variables extras cargadas sin usar y con el error de pintado "corregido"..

Le agradesco de Nuevo Maestro Antonio..

Saludos.
Soluciones y Diseño de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Diseñador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
User avatar
cuatecatl82
 
Posts: 625
Joined: Wed Mar 14, 2007 6:49 pm
Location: San Cristobal de las Casas, Chiapas México

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 37 guests