Este es el codigo que actualiza el tree segun los items que tenga
- Code: Select all Expand view RUN
IF ValType( aPerfilUsr ) == "U"
MsgStop( "NO HAY PERFILES DEFINIDOS...", "Aviso del sistema.." )
RETURN NIL
ENDIF
oBmpTree:= TImageList():New(16,16)
oBmpTree:AddMasked( TBitmap():Define( "BMP_TREE_CLOSE",, oChild ), nRGB( 255, 0, 255 ) )
oBmpTree:AddMasked( TBitmap():Define( "BMP_TREE_OPEN",, oChild ), nRGB( 255, 0, 255 ) )
oBmpTree:AddMasked( TBitmap():DEFINE( "BMP_TREE_ENABLE",, oChild ), nRGB( 255, 0, 255 ) )
oBmpTree:AddMasked( TBitmap():DEFINE( "BMP_TREE_DISABLE",, oChild ), nRGB( 255, 0, 255 ) )
oBmpTree:AddMasked( TBitmap():DEFINE( "BMP_TREE_CLOSE_SON",, oChild ), nRGB( 255, 0, 255 ) )
oBmpTree:AddMasked( TBitmap():DEFINE( "BMP_TREE_OPEN_SON",, oChild ), nRGB( 255, 0, 255 ) )
oBmpTree:AddMasked( TBitmap():DEFINE( "BMP_TREE_CLOSE_FATHER",, ::oChild ), nRGB( 255, 0, 255 ) )
oBmpTree:AddMasked( TBitmap():DEFINE( "BMP_TREE_OPEN_FHATER",, oChild ), nRGB( 255, 0, 255 ) )
IF oTreeRights != NIL
oTreeRights:DeleteAll()
ENDIF
oTreeRights:SetImageList( oBmpTree )
FOR EACH aRamas IN aPerfilUsr
IF aRamas[1] == cNivel .AND. aRamas[2]!= "00" .AND. aRamas[3]=="00"
oFile:= oTreeRights:Add( aRamas[4], 6 )
oFile:cargo:= HB_EnumIndex()
ELSE
IF aRamas[1] == cNivel .AND. aRamas[2]!= "00" .AND. aRamas[3]!="00"
IF aRamas[5] == "N"
oChild:= oFile:ADD( aRamas[4], 3 )
ELSEIF aRamas[5] == "S"
oChild:= oFile:ADD( aRamas[4], 2 )
ENDIF
oChild:cargo:= HB_EnumIndex()
ENDIF
ENDIF
END
IF oChild == NIL
oTreeRights:SetColor( CLR_BLACK, GetSysColor( COLOR_BTNFACE ) )
ELSE
oTreeRights:SetColor( CLR_BLACK, CLR_WHITE )
ENDIF
oTreeRights:Expand()
Saludos
GABO