del an Item on treview

del an Item on treview

Postby Silvio.Falconi » Mon Dec 21, 2015 9:11 am

I must del a item into a tree object ( treeview of fwh)

I found a solution to del a item from treview but it make error when I try to del a category

I have a dbf with two fields
DbCreate('GE', {{'GEMATERIA' , 'C', 40, 0} ,;
{'GEPCLAVE' , 'C', 45, 0} ,;
{'MAEJEMPL' , 'N', 5, 0}}, 'DBFCDX')

I have category and subcategory

category is tree first level (GEMATERIA)

subcategory is tree second level ( GEPCLAVE)

I made :

first del the record from dbf

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

now try to del the item on tree

oPadre := oLink:GetParent()
TVDeleteItem(oTree:hWnd, oLink:hItem )
nPosHijoenPadre := Ascan( oPadre:aItems, {|o| o:hItem == oLink:hItem } )
IF nPosHijoenPadre > 0
ADel ( oPadre:aItems, nPosHijoenPadre )
ASize( oPadre:aItems, Len(oPadre:aItems)-1 )
ENDIF




here run ok but only for subcategory
when I try to delete a category make error

Code: Select all  Expand view

    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 )
     
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: del an Item on treview

Postby Carles » Tue Dec 22, 2015 8:11 am

Silvio,

Puedes poner que muestra xBrowse( oPadre ) despues de hacer oPadre := oLink:GetParent() ? Pon lo que se muestra cuando borras una subcategoria y una categoria
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1131
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: del an Item on treview

Postby Silvio.Falconi » Tue Dec 22, 2015 10:48 am

I not use xbrowse for tree I use tree class of Linares
viewtopic.php?f=3&t=31594&p=184291&hilit=tree#p184291
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: del an Item on treview

Postby Carles » Tue Dec 22, 2015 10:51 am

Can you put MsgInfo( type( oPadre:aItems ) ) after oPadre := oLink:GetParent() ?
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1131
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: del an Item on treview

Postby Silvio.Falconi » Tue Dec 22, 2015 11:47 am

see your mail
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: del an Item on treview

Postby Carles » Tue Dec 22, 2015 12:25 pm

Silvio,

If you put here some example, i'll try to help you... thanks
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1131
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: del an Item on treview

Postby Silvio.Falconi » Tue Dec 22, 2015 12:36 pm

sorry I found the error..thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 94 guests