Page 1 of 1

problemas con END() en el nodo raiz de un tree

PostPosted: Fri Aug 11, 2023 2:32 pm
by goosfancito
Hola.
Voy agregando ramas al arbol, y puedo eliminar todas ellas sin problemas (una por una como quiero) pero al querer eliminar el "nodo" me tira error, me dice
Error description: Error BASE/1004 No existe el método: AITEMS
Args:
[ 1] = U

Stack Calls
===========
Called from: => AITEMS( 0 )
Called from: .\source\classes\TTVITEM.PRG => TTVITEM:END( 166 )


que puede estar pasando?

Re: problemas con END() en el nodo raiz de un tree

PostPosted: Sat Aug 12, 2023 5:56 am
by Antonio Linares
Estimado Gustavo,

Tienes que modificar el método End() en source\classes\TTVITEM.PRG de esta manera:
Code: Select all  Expand view
METHOD End() CLASS TTVItem

   local nAt := 0

   if ! Empty( ::oParent )
      nAt := AScan( ::oParent:aItems, { | o | o == Self } )
   endif

   if nAt != 0
      if ::oParent:IsKindOf( "TTREEVIEW" )
         ADel( ::oTree:aItems, nAt )
         ASize( ::oTree:aItems, Len( ::oTree:aItems ) - 1 )
      else
         ADel( ::oParent:aItems, nAt )
         ASize( ::oParent:aItems, Len( ::oParent:aItems ) - 1 )
      endif
   endif

   TVDeleteItem( ::oTree:hWnd, ::hItem )

return nil
 

Re: problemas con END() en el nodo raiz de un tree

PostPosted: Sat Aug 12, 2023 6:53 am
by goosfancito
Antonio Linares wrote:Estimado Gustavo,

Tienes que modificar el método End() en source\classes\TTVITEM.PRG de esta manera:
Code: Select all  Expand view
METHOD End() CLASS TTVItem

   local nAt := 0

   if ! Empty( ::oParent )
      nAt := AScan( ::oParent:aItems, { | o | o == Self } )
   endif

   if nAt != 0
      if ::oParent:IsKindOf( "TTREEVIEW" )
         ADel( ::oTree:aItems, nAt )
         ASize( ::oTree:aItems, Len( ::oTree:aItems ) - 1 )
      else
         ADel( ::oParent:aItems, nAt )
         ASize( ::oParent:aItems, Len( ::oParent:aItems ) - 1 )
      endif
   endif

   TVDeleteItem( ::oTree:hWnd, ::hItem )

return nil
 


Anda Perfecto! gracias.