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 ?
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
#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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 60 guests