From treeview Goran to fwh treeview

From treeview Goran to fwh treeview

Postby Silvio.Falconi » Fri Sep 06, 2013 8:05 am

Dear Friends,

I'd like use the treeview class of Fwh .
Until now I used another class of Goran Savckic.


Image


I have these fields FrN1, FrN2, FrN3, FrN4 y Frn5

(1,0,0,0,0)
···(1,1,0,0,0)
······(1,1,1,0,0)
······(1,1,2,0,0)
···(1,2,0,0,0)


I have some problem to converte the funcs to use fwh treeview.


on init old app I have :
Code: Select all  Expand view

          @ 0, nSplit+2 TREE oApp():oGrid OF oApp():oDlg ;
                              SIZE (oApp():oDlg:nWidth())/2, (oApp():oDlg:nHeight()-22)/2 PIXEL    ;
                              BITMAPS { "SH_PCLAVE","SH_MATERIA"}  ;
                              FONT oApp():oFont                ;
                              TREE STYLE nOr( TVS_HASLINES, TVS_HASBUTTONS ) ;
                             ON DBLCLICK FrClickTree(oApp():oGrid)   ;
                             ON CHANGE ( oLink    := oApp():oGrid:GetLinkAt( oApp():oGrid:GetCursel() ) ,;
                             xPrompt  := oLink:TreeItem:cPrompt  ,;
                              FR->(DbSetOrder(2))                 ,;
                              FR->(DbSeek(UPPER(xPrompt)))        ,;
                              FR->(DbSetOrder(1))                 ,;
                           RefreshCont(oCont,"FR") )

                          FrTreeLoad(oApp():oGrid)





STATIC function FrTreeLoad( oTree )
   local oDatabase
   local nStep
   local oLink
   local oLink1, oLink2, oLink3, oLink4, oLink5
   local N1 := 0
   local N2 := 0
   local N3 := 0
   local N4 := 0
   // oTree:bRClicked = {|nRow,nCol|  MenuTree(oTree,nRow,nCol)}

   oLink := oTree:GetRoot()

   SELECT FR

   FR->(DbGoTop())

   DO WHILE ! FR->(EOF())
      if FR->FrN2 == 0
         oLink1 := oLink:AddLastChild(FR->FrTipo,Iif(FR->FrHoja,1,2),Iif(FR->FrHoja,1,2),.t.)
         oLink1:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      elseif FR->FrN3 == 0
         oLink2 := olink1:AddLastChild(FR->FrTipo,Iif(FR->FrHoja,1,2),Iif(FR->FrHoja,1,2),.t.)
         oLink2:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      elseif FR->FrN4 == 0
         oLink3 := olink2:AddLastChild(FR->FrTipo,Iif(FR->FrHoja,1,2),Iif(FR->FrHoja,1,2),.t.)
         oLink3:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      elseif FR->FrN5 == 0
         oLink4 := olink3:AddLastChild(FR->FrTipo,Iif(FR->FrHoja,1,2),Iif(FR->FrHoja,1,2),.t.)
         oLink4:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      else
         oLink5:= oLink4:AddLastChild(FR->FrTipo,Iif(FR->FrHoja,1,2),Iif(FR->FrHoja,1,2),.t.)
         oLink5:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      endif

      FR->(DbSkip())
   ENDDO





   oTree:UpdateTV()
   oTree:SetFocus()

   return nil



Someone can help me please
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: 6804
Joined: Thu Oct 18, 2012 7:17 pm

Re: From treeview Goran to fwh treeview

Postby José Luis Sánchez » Fri Sep 06, 2013 3:16 pm

Silvio:
Code: Select all  Expand view

    oApp():oTree:=TTreeView():New(0,nSplit+2,oApp():oDlg,,,.t.)// ,oApp():oDlg:nWidth()/2,(oApp():oDlg:nHeight()-22)/2)
    oApp():oTree:SetColor(CLR_BLACK, CLR_WHITE)
    oApp():oTree:bChanged := {|| ( xPrompt := oApp():oTree:GetSelected():cPrompt,;
                                             FR->(DbSetOrder(2))                 ,;
                                             FR->(DbSeek(UPPER(xPrompt)))        ,;
                                             FR->(DbSetOrder(1))                 ,;
                                             RefreshCont(oCont,"FR") ) }
 


and

Code: Select all  Expand view

function FrTreeLoad( oTree )
   local oLink1, oLink2, oLink3, oLink4, oLink5
    local xPrompt
   SELECT FR
   FR->(DbGoTop())
   DO WHILE ! FR->(EOF())
      if FR->FrN2 == 0
         oLink1 := oTree:Add(FR->FrTipo)
         oLink1:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
            oTree:Cargo  := FR->Frn1
      elseif FR->FrN3 == 0
         oLink2 := oLink1:Add(FR->FrTipo)
         oLink2:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      elseif FR->FrN4 == 0
            oLink3 := oLink2:Add(FR->FrTipo)
         oLink3:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      elseif FR->FrN5 == 0
            oLink4 := oLink3:Add(FR->FrTipo)
         oLink4:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      else
         oLink5 := oLink4:Add(FR->FrTipo)
         oLink5:Cargo := Str(FR->Frn1,2)+Str(FR->Frn2,2)+Str(FR->Frn3,2)+Str(FR->Frn4,2)+Str(FR->Frn5,2)
      endif
      FR->(DbSkip())
   ENDDO
return nil
 


You have to load the tree in the ON INIT clause of the dialog.

FWH Tree is easier to hanldle than Goran's one.

Regards,
José Luis
User avatar
José Luis Sánchez
 
Posts: 539
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: From treeview Goran to fwh treeview

Postby Silvio.Falconi » Fri Sep 06, 2013 6:40 pm

josè , thanks so much
can we associate a bitmap for each tree .. also
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: 6804
Joined: Thu Oct 18, 2012 7:17 pm

Re: From treeview Goran to fwh treeview

Postby Silvio.Falconi » Mon Sep 09, 2013 1:34 pm

I need to Know the convertion of these lines

oTree:GetLinkAt( oTree:GetCursel() )
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: 6804
Joined: Thu Oct 18, 2012 7:17 pm

Re: From treeview Goran to fwh treeview

Postby Antonio Linares » Mon Sep 09, 2013 1:42 pm

oTree:GetSelected():...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41335
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: From treeview Goran to fwh treeview

Postby Silvio.Falconi » Mon Sep 09, 2013 1:51 pm

Perhaps something run but I have also many problems

for the insert level 1 (i Insert on bold the line give me errors)

local oLink := oTree:GetSelected()
local cPrompt := oLink:cPrompt
local cCargo := oLink:Cargo
local nLevel := INT(AT(" 0",cCargo)/2)
local oParent := oLink:GetParent()
local cPCargo := oLink:cargo



// añadir
cResto := SubStr(" 0 0 0 0 0",1,2*(5-nLevel))
oLChild := oParent:LastChild

if nLevel == 1
cNewCargo := Str(VAL(SubStr(oLChild:cargo,1,2))+1,2)+cResto
else
cNewCargo := SubStr(oLChild:Cargo,1,2*(nLevel-1))+Str(VAL(SubStr(oLChild:cargo,(2*nLevel),2))+1,2)+cResto
endif
cFaTipo := oLink:TreeItem:cPrompt + space(40-len(oLink:TreeItem:cPrompt))
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: 6804
Joined: Thu Oct 18, 2012 7:17 pm

Re: From treeview Goran to fwh treeview

Postby Antonio Linares » Mon Sep 09, 2013 1:58 pm

what errors ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41335
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: From treeview Goran to fwh treeview

Postby Silvio.Falconi » Mon Sep 09, 2013 2:32 pm

Time from start: 0 hours 0 mins 3 secs
Error occurred at: 09-09-2013, 16:32:23
Error description: Error BASE/1004 Class: 'NIL' has no exported method: LASTCHILD
Args:
[ 1] = U

Stack Calls
===========
Called from: => LASTCHILD( 0 )
Called from: source\PNewfranc.prg => FREDITA( 306 )
Called from: source\PNewfranc.prg => (b)FRANCESA2( 150 )
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: 6804
Joined: Thu Oct 18, 2012 7:17 pm

Re: From treeview Goran to fwh treeview

Postby Antonio Linares » Mon Sep 09, 2013 3:22 pm

Silvio,

It seems as oLink has no parent so:

oLink:GetParent()

is returning nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41335
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: From treeview Goran to fwh treeview

Postby Silvio.Falconi » Mon Sep 09, 2013 3:46 pm

Antonio with Goran I made

local cFaTipo
local oLink := oTree:GetLinkAt( oTree:GetCursel() )
local cPrompt := oLink:TreeItem:cPrompt
local cCargo := oLink:Cargo
local nLevel := INT(AT(" 0",cCargo)/2)
local oParent := oLink:ParentLink
local oLChild
local oNewLink
local cPCargo := oParent:cargo
local cNewCargo := ""
local lFrHoja
local cResto



and I now ( for fwh tree ) I change into


local oLink := oTree:GetSelected()
local cPrompt := oLink:cPrompt
local cCargo := oLink:Cargo
local nLevel := INT(AT(" 0",cCargo)/2)
local oParent := oLink:GetParent()
local oLChild
local oNewLink
local cPCargo := oLink:cargo
local cNewCargo := ""
local lFrHoja
local cResto
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: 6804
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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