Treeview with checkbox ?

User avatar
goosfancito
Posts: 1392
Joined: Fri Oct 07, 2005 7:08 pm

Post by goosfancito »

Funciona, gracias.
JC wrote:Gustavo,

This procedure can do it!

Code: Select all

PROCEDURE checkTreeView( oItemTree, lComplete, lCheckComplete )

LOCAL oObjTree, oObjItem

LOCAL nPos := 0

DEFAULT lComplete      := NIL, ;
        lCheckComplete := NIL



oObjTree := iif( valType( oItemTree ) == "O" .AND. upper( oItemTree:className() ) == "TTREEVIEW", oItemTree, oItemTree:oTree )

IF !isNull( lComplete )

   FOR nPos := 1 TO len( oObjTree:aItems )

       oObjItem := oObjTree:aItems[nPos]

       IF !isEmpty( oObjItem:aItems )
          checkTreeView( oObjItem,, lComplete )
       ELSE
          oObjTree:setCheck( oObjItem, lComplete )
       ENDIF

   NEXT

ELSE

   oObjTree:setCheck( oItemTree, iif( !isNull( lCheckComplete ), lCheckComplete, !oObjTree:getCheck( oItemTree ) ) )

   FOR nPos := 1 TO len( oItemTree:aItems )

       oObjItem := oItemTree:aItems[nPos]

       IF !isEmpty( oObjItem:aItems )
          checkTreeView( oObjItem,, lCheckComplete )
       ELSE
          oObjTree:setCheck( oObjItem, iif( !isNull( lCheckComplete ), lCheckComplete, !oObjTree:getCheck( oObjItem ) ) )
       ENDIF

   NEXT

ENDIF

RETURN( NIL )
Un aporte chico hace grandes cambios.
Apoyemos al proyecto "Hogar pimpinela"
Bajate la aplicación (gratuita) y encuentra en ella toda la info de como podes colaborar.
GRACIAS!
https://play.google.com/store/apps/deta ... .acomprar
Post Reply