#include "FiveWin.ch"
#INCLUDE "XBROWSE.CH"
//------------------------------------------------
Function RecargarXBrw()
local oDlg, oBrw
local aTits := {"Nombre","Ciudad"}
local aCols := {{"First"},{"City"}}
local aTitCols := {"Nombre","Apellido","Calle","Ciudad"}
local aCampos := {"First","Last","Street","City"}
local aTitC := {"Nombre","Calle","Ciudad"}
local aCamp := {"First","Street","City"}
DEFINE DIALOG oDlg SIZE 640,400 PIXEL
@ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
COLUMNS aCols ;
HEADERS aTits ;
ARRAY aCols CELL LINES NOBORDER
oBrw:CreateFromCode()
@ 10,10 BUTTON "Recargar" SIZE 40,12 PIXEL OF oDlg ACTION ( Recarga(oBrw,aTitCols,aCampos,120) )
@ 10,70 BUTTON "Recargar2" SIZE 40,12 PIXEL OF oDlg ACTION ( Recarga(oBrw,aTitC,aCamp,150) )
ACTIVATE DIALOG oDlg CENTERED
return nil
//------------------------------------------
Function Recarga(oBrw,aTitCols,aCampos,nWdCols)
local cAlias, aData:={}
USE CUSTOMER NEW
DBSELECTAREA("CUSTOMER")
cAlias := Alias()
xDbf2Arr(cAlias,aData,aCampos) //Convertir dbf a Array
CUSTOMER->(DBCLOSEAREA())
oBrw:SetArray(aData,.t.,1,.t.)
oBrw:cHeaders := aTitCols
AEval(oBrw:aCols,{|o,n,oCol| o:nWidth := nWdCols })
oBrw:Refresh(.t.)
oBrw:SetFocus()
RETURN NIL
//-----------------------------
Function xDbf2Arr(cAlias,aData,aCampos)
local aDat, n
For n := 1 to len(aCampos) //POR SI ACA...
aCampos[n]:= Upper(aCampos[n])
Next
(cAlias)->(dbgotop())
While !eof()
aDat:={}
For n:=1 to FCount()
if ASCAN(aCampos, (cAlias)->(FieldName(n)) ) != 0
aadd(aDat,(cAlias)->(FieldGet(n)) )
endif
Next
aadd(aData,aDat)
dbSkip()
Enddo
SysRefresh()
Return nil
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: nageswaragunupudi and 47 guests