I have problem with a Xbrowse oTree
It run ok but it showed bad the records and I not understood how show it as a tree

the codice field is 8 CR
the desc field is 50 CR
11 first level
1122 second level
11223333 third level
I wish show in this mode :
01 Hardware
------- > 0101 Monitor
-------------01010001 Monitor color
this is the test :
I hope someone can help me
thanks in advance!!
It run ok but it showed bad the records and I not understood how show it as a tree

the codice field is 8 CR
the desc field is 50 CR
11 first level
1122 second level
11223333 third level
I wish show in this mode :
01 Hardware
------- > 0101 Monitor
-------------01010001 Monitor color
this is the test :
#include 'fivewin.ch'
#include 'colors.ch'
#include 'xbrowse.ch'
#include "constant.ch"
REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
Function test()
Local odlg,oBrw,oFont
Local nBottom := 24
Local nRight := 88
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
RddSetDefault( "DBFCDX" )
USE TABMAG
INDEX ON Field->CODICE TO Codice
SET ORDER TO "Codice"
GO TOP
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE nWidth, nHeight PIXEL FONT oFont
@ 20,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg LINES CELL
oBrw:SetTree( BuildTree(), { "open", "close", "go" } )
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 1 ] HEADER "Codice"
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 2 ] HEADER "Descrizione"
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
oBrw:lRecordSelector := .F. // .t.
oBrw:lAllowRowSizing := .F.
oBrw:lColDividerComplete := .F. // .f.
oBrw:lAllowColSwapping := .F.
oBrw:lAllowColHiding := .F.
oBrw:lFastEdit := .F.
oBrw:nRowDividerStyle := LINESTYLE_NOLINES
oBrw:nColDividerStyle := LINESTYLE_NOLINES
oBrw:CreateFromCode()
oBrw:aCols[ 1 ]:cHeader = "Codice"
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
static function BuildTree()
local oTree, cCodice
TREE oTree
while ! Eof()
if Empty( cCodice )
_TreeItem( TABMAG->CODICE ):Cargo := { space(15) ,space(50) }
TREE
cCodice = TABMAG->CODICE
else
if cCodice != TABMAG->CODICE
ENDTREE
cCodice = TABMAG->CODICE
_TreeItem( TABMAG->CODICE ):Cargo := {space(15) , space(50) }
TREE
endif
endif
if TABMAG->CODICE == cCodice
_TreeItem( TABMAG->Desc ):Cargo := { space(15) , TABMAG->Desc }
endif
SKIP
enddo
ENDTREE
ENDTREE
GO TOP
return oTreeI hope someone can help me
thanks in advance!!
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
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