Also for tree ( fwh)

Also for tree ( fwh)

Postby Silvio.Falconi » Sun Nov 22, 2015 6: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

Image


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

Image



Any solution ?
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: Also for tree ( fwh)

Postby MaxP » Wed Nov 25, 2015 5:25 pm

You can save the recno using the variable cargo

Code: Select all  Expand view

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
User avatar
MaxP
 
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm

Re: Also for tree ( fwh)

Postby Silvio.Falconi » Wed Nov 25, 2015 6:09 pm

Max not run ok

I add a say to simulate my text change

Code: Select all  Expand view


#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 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: Also for tree ( fwh)

Postby Silvio.Falconi » Thu Nov 26, 2015 9:25 am

Any solution 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: 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 60 guests