#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oBrw
local oTree , oBtn
/*USE Customer alias "cus"
INDEX ON Field->State TO State
SET ORDER TO "State"*/
LlenarMatris()
GO TOP
DEFINE WINDOW oWnd TITLE "Cambiando el tipo de datos xbrowse"
@ 10,200 BTNBMP oBtn PROMPT "TREE" SIZE 150,30 PIXEL OF oWnd FLAT ;
ACTION Mutar(oBrw, oBtn)
@ 50,0 XBROWSE oBrw OF oWnd ;
LINES STYLE FLAT NOBORDER CELL;
alias "cus" COLUMNS "Peso","Zona", "Precio";
HEADERS "Peso","Zona", "Precio" PIXEL SIZE 1300,600
//oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
oBrw:CreateFromCode()
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
******************************************
** Mutar vista
STATIC FUNCTION Mutar(oBrw,oBot)
IF !oBrw:nDataType == 1
oBrw:ResetData( alias(),{"Peso","Zona", "Precio"} )
oBrw:GoTop()
oBot:cTitle := "TREE"
ELSE
oBrw:SetTree( 2)
oBrw:oTree:OpenAll()
oBrw:GoTop()
oBot:cTitle := "BROWSE"
endif
RETURN nil
STATIC FUNCTION LlenarMatris()
local aCols, aDatos, i
IF File('armando.dbf')
USE armando alias "cus"
INDEX ON Field->peso TO peso
SET ORDER TO "peso"
RETURN nil
ELSE
aCols := { ;
{ "peso", 'N', 4, 0 }, ;
{ "zona", 'N', 4, 0 }, ;
{ "precio", 'N', 10, 2 } }
DBCREATE("ARMANDO.DBF",aCols, "DBFCDX",.t.,'DAT')
aDatos := { { 1, 1, 50.00},;
{ 1, 2, 75.00},;
{ 1, 3, 90.00},;
{ 1, 4, 150.00},;
{ 2, 1, 80.00},;
{ 2, 2, 120.00},;
{ 2, 3, 150.00},;
{ 2, 4, 200.00},;
{ 2, 5, 210.00},;
{ 3, 1, 125.00}}
for i := 1 to LEN(aDatos)
DAT->( DBAPPEND() )
DAT->( FieldPut( 1, aDatos[i,1] ))
DAT->( FieldPut( 2, aDatos[i,2] ))
DAT->( FieldPut( 3, aDatos[i,3] ))
next i
CLOSE DAT
USE armando alias "cus"
INDEX ON Field->peso TO peso
SET ORDER TO "peso"
ENDIF
RETURN nil