FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Also for tree ( fwh)
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Also for tree ( fwh)
Posted: Sun Nov 22, 2015 06:21 PM
on xbrowse I use the parameters bchange to refresh() the number of record




Aldo on oTree I use this and run ok if the level I select is the first level




but When I select a second level of tree it return me 0 ( zero)





Any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 99
Joined: Thu Jul 12, 2007 02:02 PM
Re: Also for tree ( fwh)
Posted: Wed Nov 25, 2015 05:25 PM
You can save the recno using the variable cargo

Code (fw): Select all Collapse
function BuildTree( oTree )
   local oLink1, oLink2

   SELECT GE
   GE->(DbGoTop())

      DO WHILE ! GE->(EOF())
        if Rtrim(GE->GEPClave) == ""
         oLink1 := oTree:Add(GE->GEMATERIA,0)
         oLink1:Cargo := { Upper(GE->GEMATERIA), RECNO() }
         oTree:Cargo  := GE->GEMATERIA
     else
         oLink2 := oLink1:Add(GE->GEPClave,1)
         oLink2:Cargo := { Upper(GE->GEMATERIA) + Upper(GE->GEPClave), RECNO() }
      endif
      GE->(DbSkip())
   ENDDO

   oTree:SetFocus()
   oTree:expandall()

   return nil


Regards
Massimo
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Also for tree ( fwh)
Posted: Wed Nov 25, 2015 06:09 PM
Max not run ok

I add a say to simulate my text change

Code (fw): Select all Collapse
 

#include "fivewin.ch"
#include "constant.ch"
#include "wcolors.ch"


Static oTree,oImageList




REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO


Function Test()
   Local oDlg,oTree
   Local  nBottom   := 20
   Local  nRight    := 52
   Local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local  nHeight := nBottom * DLG_CHARPIX_H

   lOCAL  oBtnAceptar, oBtnCancel
   LOCAL  cMateria :=""
   local lok:=.f.

   RddSetDefault( "DBFCDX" )

   USE GRUENT ALIAS GE
   INDEX ON UPPER(GE->GEMATERIA)+UPPER(GE->GEPCLAVE) TAG GE01 FOR !Deleted()
   INDEX ON UPPER(GE->GEMATERIA) TAG GE02  FOR   ((!DELETED()) )


 DEFINE DIALOG oDlg     ;
  TITLE "Test Tree" ;
  SIZE nWidth, nHeight PIXEL          ;
  STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )


   oTree = TTreeView():New( 2, 0, oDlg,,,, , 150, 120)



   oTree:bChanged := {|| ( xPrompt := oTree:GetSelected():cPrompt,;
                                      GE->(DbSetOrder(2))                 ,;
                                      GE->(DbSeek(UPPER(xPrompt)))        ,;
                                      RefreshCont(oSay,"GE",xPrompt) ) }



   @ 10,10 say oSay Prompt tran(GE->(OrdKeyNo()),'@E 999,999')+" / "+tran(GE->(OrdKeyCount()),'@E 999,999') of oDlg size 100,10 pixel

   @ 120, 155 BUTTON oBtnAceptar PROMPT "&Conferma" ;
            SIZE 48, 10 PIXEL OF oDlg ;
             ACTION oDlg:End()

   @ 134, 155 BUTTON oBtnCancel PROMPT "&Annulla" ;
             SIZE 48, 10 PIXEL OF oDlg ;
             ACTION oDlg:End()




       ACTIVATE DIALOG oDlg CENTERED    ;
                        ON INIT (oImageList:=LoadImagelist(oDlg),;
                                 BuildTree( oTree ),;
                                 oTree:SetImageList( oImageList )  )


       return nil


 //----------------------------------------------------------------------------------------------------------------------//

FUNCTION RefreshCont( oCont,cdbf)
   oCont:SetText( i18n("Rec.")+tran((cdbf)->(OrdKeyNo()),'@E 999,999')+" / "+tran((cdbf)->(OrdKeyCount()),'@E 999,999') )
   oCont:refresh()
RETURN nil







//---------------------------------------------------------------------------------------------------//

static function FrClickTree( oTree )
   local oLink    := oTree:GetSelected
   local cPrompt  := oLink:cPrompt
       msginfo(cPrompt)
return nil

//---------------------------------------------------------------------------------------------------//




function BuildTree( oTree )
   local oLink1, oLink2

   SELECT GE
   GE->(DbGoTop())

      DO WHILE ! GE->(EOF())
        if Rtrim(GE->GEPClave) == ""
         oLink1 := oTree:Add(GE->GEMATERIA,0)
         oLink1:Cargo := { Upper(GE->GEMATERIA), RECNO() }
         oTree:Cargo  := GE->GEMATERIA
     else
         oLink2 := oLink1:Add(GE->GEPClave,1)
         oLink2:Cargo := { Upper(GE->GEMATERIA) + Upper(GE->GEPClave), RECNO() }
      endif
      GE->(DbSkip())
   ENDDO

   oTree:SetFocus()
   oTree:expandall()

   return nil


//-----------------------------------------------------------------------------------------------------//

   Function LoadImagelist(oDlg)
   Local  oImageList := TImageList():New()
   Local  oBmp1 ,oBmp2
   *oBmp3 ,oBmp4


   oBmp1 := TBitmap():Define( "TREELEVEL1"   , , oDlg )
   oBmp2 := TBitmap():Define( "TREELEVEL2"   , , oDlg )

    oImageList:Add( oBmp1 )
    oImageList:Add( oBmp2 )


  Return oImageList
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Also for tree ( fwh)
Posted: Thu Nov 26, 2015 09:25 AM

Any solution please ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion