Xbrowse Tree using Array instead of DBF
Xbrowse Tree using Array instead of DBF
Hi!
It's been a while since I posted but almost everyday I read topics here..
I usually do xbrowse tree using DBF data..
I couldn't find an example using Array data for an xbrowse tree.. anyone? .. Mr. RAO?
Kind Regards,
Frances
It's been a while since I posted but almost everyday I read topics here..
I usually do xbrowse tree using DBF data..
I couldn't find an example using Array data for an xbrowse tree.. anyone? .. Mr. RAO?
Kind Regards,
Frances
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Re: Xbrowse Tree using Array instead of DBF
Try this.
Regards
Anser
Code: Select all
#include "FiveWin.ch"
#include "xBrowse.ch"
//---------------------//
Function Main()
Local oBrw,oWnd
DEFINE WINDOW oWnd TITLE "Tree using Array"
@0,0 XBROWSE oBrw OF oWnd
WITH OBJECT oBrw
:SetTree(BuildTree())
:oTree:OpenAll()
:CreateFromCode()
END
oWnd:oClient:=oBrw
ACTIVATE WINDOW oWnd
Return NIL
//---------------------//
Function BuildTree()
Local oTree,nTreeCount,nPrevLevel,nCurLevel,nLevelDiff
Local i,j
Local aItems:={ {"01","Computers" ,0},;
{"02","Core i3" ,1},;
{"03","Core i5" ,1},;
{"04","Furnitures" ,0},;
{"05","Tables" ,1},;
{"06","Computer Table" ,2},;
{"07","Regular Table" ,2},;
{"08","Desk" ,1},;
{"09","Computer Desk" ,2},;
{"10","Regular Desk" ,2},;
{"11","Chairs" ,1} }
TREE oTree
nLevel:=aItems[1][3]
nTreeCount:=0
For i:=1 to Len(aItems)
if aItems[i][3] > nLevel
TREE
nTreeCount++
Elseif aItems[i][3] < nLevel
nPrevLevel:=nLevel
nCurLevel:=aItems[i][3]
nLevelDiff:=nPrevLevel-nCurLevel
For j:=1 to nLevelDiff
ENDTREE
nTreeCount--
Next
Endif
TREEITEM aItems[i][2] CARGO { aItems[i][1] } // Item Code
nLevel:=aItems[i][3]
Next
if nTreeCount > 0
For i:=nTreeCount To 1 Step -1
ENDTREE
Next
Endif
ENDTREE
Return oTree
Anser
- RAMESHBABU
- Posts: 591
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India
Re: Xbrowse Tree using Array instead of DBF
Hello Anser,
Very Good Example
Regards,
- Ramesh
Very Good Example
Regards,
- Ramesh
Re: Xbrowse Tree using Array instead of DBF
Hi Anser!
That's a good one!
Kind regards,
Frances
That's a good one!
Kind regards,
Frances
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Re: Xbrowse Tree using Array instead of DBF
anserkk wrote:Try this.
RegardsCode: Select all
#include "FiveWin.ch" #include "xBrowse.ch" //---------------------// Function Main() Local oBrw,oWnd DEFINE WINDOW oWnd TITLE "Tree using Array" @0,0 XBROWSE oBrw OF oWnd WITH OBJECT oBrw :SetTree(BuildTree()) :oTree:OpenAll() :CreateFromCode() END oWnd:oClient:=oBrw ACTIVATE WINDOW oWnd Return NIL //---------------------// Function BuildTree() Local oTree,nTreeCount,nPrevLevel,nCurLevel,nLevelDiff Local i,j Local aItems:={ {"01","Computers" ,0},; {"02","Core i3" ,1},; {"03","Core i5" ,1},; {"04","Furnitures" ,0},; {"05","Tables" ,1},; {"06","Computer Table" ,2},; {"07","Regular Table" ,2},; {"08","Desk" ,1},; {"09","Computer Desk" ,2},; {"10","Regular Desk" ,2},; {"11","Chairs" ,1} } TREE oTree nLevel:=aItems[1][3] nTreeCount:=0 For i:=1 to Len(aItems) if aItems[i][3] > nLevel TREE nTreeCount++ Elseif aItems[i][3] < nLevel nPrevLevel:=nLevel nCurLevel:=aItems[i][3] nLevelDiff:=nPrevLevel-nCurLevel For j:=1 to nLevelDiff ENDTREE nTreeCount-- Next Endif TREEITEM aItems[i][2] CARGO { aItems[i][1] } // Item Code nLevel:=aItems[i][3] Next if nTreeCount > 0 For i:=nTreeCount To 1 Step -1 ENDTREE Next Endif ENDTREE Return oTree
Anser
Hola buenas tardes Anserk,como esta, estoy tratando de compilar tu ejemplo, pero me marca error,que es lo que hace falta,uso version 8.12
//---------------------//
Function BUSCAR1()
Local oBrw,oWnd
DEFINE WINDOW oWnd TITLE "Tree using Array"
@0,0 XBROWSE oBrw OF oWnd
WITH OBJECT oBrw
:SetTree(BuildTree())
:oTree:OpenAll()
:CreateFromCode()
END
oWnd:oClient:=oBrw
ACTIVATE WINDOW oWnd
Return NIL
//---------------------//
Function BuildTree()
Local oTree,nTreeCount,nPrevLevel,nCurLevel,nLevelDiff
Local i,j,nLevel
Local aItems:={ {"01","Computers" ,0},;
{"02","Core i3" ,1},;
{"03","Core i5" ,1},;
{"04","Furnitures" ,0},;
{"05","Tables" ,1},;
{"06","Computer Table" ,2},;
{"07","Regular Table" ,2},;
{"08","Desk" ,1},;
{"09","Computer Desk" ,2},;
{"10","Regular Desk" ,2},;
{"11","Chairs" ,1} }
TREE oTree
nLevel:=aItems[1][3]
nTreeCount:=0
For i:=1 to Len(aItems)
if aItems[3] > nLevel
TREE
nTreeCount++
Elseif aItems[3] < nLevel
nPrevLevel:=nLevel
nCurLevel:=aItems[3]
nLevelDiff:=nPrevLevel-nCurLevel
For j:=1 to nLevelDiff
ENDTREE
nTreeCount--
Next
Endif
TREEITEM aItems[2] CARGO { aItems[1] } // Item Code
nLevel:=aItems[3]
Next
if nTreeCount > 0
For i:=nTreeCount To 1 Step -1
ENDTREE
Next
Endif
ENDTREE
Return oTree
Este es el error :
C:\Pro_FWH\ProveIVA\Prg\buscar1.prg(70) Error E0030 Syntax error: "syntax
error at 'AITEMS'"
Estoy tratando de adaptar a mi catalago de cuentas de 1 a 4 niveles de cuentas con caracter y longitud 16 ,y estaba tomando tu ejemplo, pero no me sale desde mi dbfs.
Saludos y buen dia.
Atte: Adrian C. C.
Re: Xbrowse Tree using Array instead of DBF
Sorry,
I cannot find line 70 in your code. As per your message, the error occurs at line 70. The max no of lines in the code posted by you is only 61.
Did you try the sample code posted by me on your PC using your FHW ver 8.12 ?. Did it work ?
Regards
Anser
I cannot find line 70 in your code. As per your message, the error occurs at line 70. The max no of lines in the code posted by you is only 61.
Did you try the sample code posted by me on your PC using your FHW ver 8.12 ?. Did it work ?
Regards
Anser
Re: Xbrowse Tree using Array instead of DBF
Hola buenos dias de nuevo, el error se produce aqui en esta linea ....anserkk wrote:Sorry,
I cannot find line 70 in your code. As per your message, the error occurs at line 70. The max no of lines in the code posted by you is only 61.
Did you try the sample code posted by me on your PC using your FHW ver 8.12 ?. Did it work ?
Regards
Anser
For i:=1 to Len(aItems)
if aItems[3] > nLevel
TREE
nTreeCount++
Elseif aItems[3] < nLevel
nPrevLevel:=nLevel
nCurLevel:=aItems[3]
nLevelDiff:=nPrevLevel-nCurLevel
For j:=1 to nLevelDiff
ENDTREE
nTreeCount--
Next
Endif
TREEITEM aItems[2] CARGO { aItems[1] } // Item Code /// Anserk aqui se me produce este error, y es con tu codigo que estoy probando....
nLevel:=aItems[3]
Next
Quiero implementar mi catalogo de cuentas en forma de tree,mi estructura en la base de datos es asi : Cuentas caracter longitud 16 y nivel longitud 1 numerico
CUENTAS NIVEL DESCRIPCION
1020-0000-0000-0000 1 Cuenta mayor
1020-0001-0000-0000 2 Subcta
1020-0001-0001-0000 3 Subsubcta
1020-0001-0001-0001 4 subsubctanddetalles
Pero como hacerle con tu ejemplo, que intento compilar, pero ese error me sigue dando, y es el mismo ejemplo con tu codigo, solo le agregue la variable nLevel, que no estaba declarado,uso VERCE 5.0 y FWH 8.12
Saludos y buen dia Anserk
Atte: Adrian C. C.
Re: Xbrowse Tree using Array instead of DBF
I use normal xBrowse with
oBrw:bIndent := { ||20 + ( ::cAlias )->TREELEVEL * 20 }
instead of treeView.
Best regards,
Otto
oBrw:bIndent := { ||20 + ( ::cAlias )->TREELEVEL * 20 }
instead of treeView.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
Re: Xbrowse Tree using Array instead of DBF
To do a test with your FWH ver, I don't have FWH 8.12 here with me right now.
Many changes has been implemented to Tree after Ver 8.12
Anyway Tree with your data is working fine here with the latest FWH version.
CUENTAS NIVEL DESCRIPCION
1020-0000-0000-0000 1 Cuenta mayor
1020-0001-0000-0000 2 Subcta
1020-0001-0001-0000 3 Subsubcta
1020-0001-0001-0001 4 subsubctanddetalles
Regards
Anser
Many changes has been implemented to Tree after Ver 8.12
Anyway Tree with your data is working fine here with the latest FWH version.
CUENTAS NIVEL DESCRIPCION
1020-0000-0000-0000 1 Cuenta mayor
1020-0001-0000-0000 2 Subcta
1020-0001-0001-0000 3 Subsubcta
1020-0001-0001-0001 4 subsubctanddetalles
Code: Select all
#include "FiveWin.ch"
#include "xBrowse.ch"
//---------------------//
Function Main()
Local oBrw,oWnd
DEFINE WINDOW oWnd TITLE "Tree using Array"
@0,0 XBROWSE oBrw OF oWnd
WITH OBJECT oBrw
:SetTree(BuildTree())
:oTree:OpenAll()
:CreateFromCode()
END
oWnd:oClient:=oBrw
ACTIVATE WINDOW oWnd
Return NIL
//---------------------//
Function BuildTree()
Local oTree,nTreeCount,nPrevLevel,nCurLevel,nLevelDiff
Local i,j
/* Local aItems:={ {"01","Computers" ,0},;
{"02","Core i3" ,1},;
{"03","Core i5" ,1},;
{"04","Furnitures" ,0},;
{"05","Tables" ,1},;
{"06","Computer Table" ,2},;
{"07","Regular Table" ,2},;
{"08","Desk" ,1},;
{"09","Computer Desk" ,2},;
{"10","Regular Desk" ,2},;
{"11","Chairs" ,1} }
*/
Local aItems:={ {"1020-0000-0000-0000", 1,"Cuenta mayor"},;
{"1020-0001-0000-0000", 2,"Subcta"},;
{"1020-0001-0001-0000", 3,"Subsubcta"},;
{"1020-0001-0001-0001", 4,"subsubctanddetalles"} }
TREE oTree
nLevel:=aItems[1][2]
nTreeCount:=0
For i:=1 to Len(aItems)
if aItems[i][2] > nLevel
TREE
nTreeCount++
Elseif aItems[i][2] < nLevel
nPrevLevel:=nLevel
nCurLevel:=aItems[i][2]
nLevelDiff:=nPrevLevel-nCurLevel
For j:=1 to nLevelDiff
ENDTREE
nTreeCount--
Next
Endif
TREEITEM aItems[i][3] CARGO { aItems[i][1] } // Item Code
nLevel:=aItems[i][2]
Next
if nTreeCount > 0
For i:=nTreeCount To 1 Step -1
ENDTREE
Next
Endif
ENDTREE
Return oTree
Anser
Re: Xbrowse Tree using Array instead of DBF
anserkk wrote:To do a test with your FWH ver, I don't have FWH 8.12 here with me right now.
Many changes has been implemented to Tree after Ver 8.12
Anyway Tree with your data is working fine here with the latest FWH version.
CUENTAS NIVEL DESCRIPCION
1020-0000-0000-0000 1 Cuenta mayor
1020-0001-0000-0000 2 Subcta
1020-0001-0001-0000 3 Subsubcta
1020-0001-0001-0001 4 subsubctanddetalles
RegardsCode: Select all
#include "FiveWin.ch" #include "xBrowse.ch" //---------------------// Function Main() Local oBrw,oWnd DEFINE WINDOW oWnd TITLE "Tree using Array" @0,0 XBROWSE oBrw OF oWnd WITH OBJECT oBrw :SetTree(BuildTree()) :oTree:OpenAll() :CreateFromCode() END oWnd:oClient:=oBrw ACTIVATE WINDOW oWnd Return NIL //---------------------// Function BuildTree() Local oTree,nTreeCount,nPrevLevel,nCurLevel,nLevelDiff Local i,j /* Local aItems:={ {"01","Computers" ,0},; {"02","Core i3" ,1},; {"03","Core i5" ,1},; {"04","Furnitures" ,0},; {"05","Tables" ,1},; {"06","Computer Table" ,2},; {"07","Regular Table" ,2},; {"08","Desk" ,1},; {"09","Computer Desk" ,2},; {"10","Regular Desk" ,2},; {"11","Chairs" ,1} } */ Local aItems:={ {"1020-0000-0000-0000", 1,"Cuenta mayor"},; {"1020-0001-0000-0000", 2,"Subcta"},; {"1020-0001-0001-0000", 3,"Subsubcta"},; {"1020-0001-0001-0001", 4,"subsubctanddetalles"} } TREE oTree nLevel:=aItems[1][2] nTreeCount:=0 For i:=1 to Len(aItems) if aItems[i][2] > nLevel TREE nTreeCount++ Elseif aItems[i][2] < nLevel nPrevLevel:=nLevel nCurLevel:=aItems[i][2] nLevelDiff:=nPrevLevel-nCurLevel For j:=1 to nLevelDiff ENDTREE nTreeCount-- Next Endif TREEITEM aItems[i][3] CARGO { aItems[i][1] } // Item Code nLevel:=aItems[i][2] Next if nTreeCount > 0 For i:=nTreeCount To 1 Step -1 ENDTREE Next Endif ENDTREE Return oTree
Anser
Gracias Anserk, yo creo que si tienes razon, ha de ser mi version, porque hasta la variable nLevel, la tuve que definir ,porque no me la reconocia,le preguntare a Antonio LInares, con cual podria sustituir la variable aItems, para mi version 8.12., o hay otra manera de crear para ese modulo que me esta dando vueltas la cabeza, con mi arbol de catalogo de cuentas.
Gracias de todos modos y un saludos
Atte: Adrian C. C.
Re: Xbrowse Tree using Array instead of DBF
and if I wish insert a check for each item how I can make ?
for a sample I have a menu items and I wish show any items instead of others
for a sample I have a menu items and I wish show any items instead of others
Re: Xbrowse Tree using Array instead of DBF
Silvio,
try to use oBrw:bIndent.
Best regards,
Otto
try to use oBrw:bIndent.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
Re: Xbrowse Tree using Array instead of DBF
where ? can you modify the test made from Anserkk please ?
or made another
I use an array to create ribbon
aMenuRibbon := { "Gestione Ufficio Tecnico","Hardware","Software","Manuali","Prestiti","Magazzino","Utilità","Aiuto" }
::obar:=TRibbonBar():New(::oWndMain, aMenuRibbon,,,,140,25,,,,,,,,,,.F.,1 )
we can create a configuration to set wich menu we not want to show....
or made another
I use an array to create ribbon
aMenuRibbon := { "Gestione Ufficio Tecnico","Hardware","Software","Manuali","Prestiti","Magazzino","Utilità","Aiuto" }
::obar:=TRibbonBar():New(::oWndMain, aMenuRibbon,,,,140,25,,,,,,,,,,.F.,1 )
we can create a configuration to set wich menu we not want to show....