Saludos a Todos:
Estoy armando un Tree en base al ejemplo re.prg, ya armado un arbol de items como puedo borrar items, he buscado y probado por varias formas pero no funciona, hay alguna forma de poderlo realizar..
Local nSect
Local nPos
Local oIt := oTree:GetSelected()
if !Empty( oIt )
nSect := oTree:GetItemPos( oIt:oParent )
nPos := oIt:oParent:GetItemPos( oIt )
oIt:oParent:aItems[ nPos ]:DeleteBranches()
oIt:oParent:DelItemPos( nPos )
endif
// Buscamos el Padre del que cuelga este Item
oPadre := oBranch:GetParent()
TVDeleteItem( ::oTree:hWnd, oBranch:hItem )
// TVDeleteItem borra la rama pero NO elimina de la clase el Item de la rama
nPosHijoenPadre := Ascan( oPadre:aItems, {|o| o:hItem == oBranch:hItem } )
IF nPosHijoenPadre > 0
ADel ( oPadre:aItems, nPosHijoenPadre )
ASize( oPadre:aItems, Len(oPadre:aItems)-1 )
ENDIF
Application
===========
Path and name: C:\Documents and Settings\Administrator\Desktop\tree\test.Exe (32 bits)
Size: 2,737,664 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
FiveWin Version: FWHX 15.01
Windows version: 5.1, Build 2600 Service Pack 3
Time from start: 0 hours 1 mins 13 secs
Error occurred at: 12/18/15, 10:06:55
Error description: Error BASE/1004 Class: 'NIL' has no exported method: AITEMS
Args:
[ 1] = U
Stack Calls
===========
Called from: => AITEMS( 0 )
Called from: test.prg => MABORRA( 244 )
Called from: test.prg => (b)TEST( 67 )
Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK( 175 )
Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1687 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
Called from: => SENDMESSAGE( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 403 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 906 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 286 )
Called from: test.prg => TEST( 104 )
local oLink := oTree:GetSelected()
local cPrompt := oLink:cPrompt
local cCargo := oLink:Cargo
local nRecno := GE->(Recno())
local lMateria := ( Len(cCargo) <= 40 )
local nNext
SELECT GE
GE->(DbSkip())
nNext := GE->(Recno())
GE->(DbGoto(nRecno))
GE->(DbDelete())
GE->(DbPack())
GE->(DbGoto(nNext))
IF GE->(EOF()) .or. nNext == nRecno
GE->(DbGoBottom())
ENDIF
// CANCELLO IL TREE
// oLink:End() // <-----------------
* TvDeleteItem( oTree:hWnd, oLink:hItem )
* MyDelItem( oTree, oLink )
// Buscamos el Padre del que cuelga este Item
oPadre := oLink:GetParent()
TVDeleteItem(oTree:hWnd, oLink:hItem )
// TVDeleteItem borra la rama pero NO elimina de la clase el Item de la rama
nPosHijoenPadre := Ascan( oPadre:aItems, {|o| o:hItem == oLink:hItem } )
IF nPosHijoenPadre > 0
ADel ( oPadre:aItems, nPosHijoenPadre )
ASize( oPadre:aItems, Len(oPadre:aItems)-1 )
ENDIF
ENDIF
oTree:refresh()
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 79 guests