by goosfancito » Mon Oct 27, 2008 1:54 pm
Funciona, gracias.
JC wrote:Gustavo,
This procedure can do it!
- Code: Select all Expand view
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 )