- Code: Select all Expand view RUN
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oDlg, oBrw, oCol, aRecord, nAt := 1
USE Customer
aRecord = Array( Customer->( FCount() ) )
DEFINE DIALOG oDlg SIZE 300, 300
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY aRecord // AUTOSORT
oCol = oBrw:AddCol()
oCol:bStrData = { || Customer->( FieldName( oBrw:nArrayAt ) ) }
oCol:cHeader = "FieldName"
oCol = oBrw:AddCol()
oCol:bStrData = { || Customer->( FieldGet( oBrw:nArrayAt ) ) }
oCol:cHeader = "Value"
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
oBrw:CreateFromCode()
oBrw:bKeyCount = { || Customer->( FCount() ) }
oDlg:oClient = oBrw
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT oDlg:Resize()
return nil
This show all fields of customer.dbf
But If we want show only some fields of this dbf How We can do ?
sample If we create two array sample :
aFields:={First,Last ,state,salary }
aNames:={"Name","surname" ,"State","salary" }
and call a function Ut_BrwColVert(cDbf,aFields,aNames)
I tried to create this function but not run well because not take the right field
FUNCTION Ut_BrwColVert(cDbf,aTitles,aFields)
local oDlgVista, oBrw
Local nBottom := 33
Local nRight := 66
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
lOCAL aStruct
IF LEN(aFields)=0
aStruct := (cdbf)->( DbStruct() )
ELSE
aStruct :=aFields
eNDIF
IF nType =1
If Len( aStruct) != Len(aTitles)
msginfo("Error on titles - fields","ATTENtION!")
return nil
ENDIF
DEFINE DIALOG oDlgVista SIZE nWidth, nHeight ;
Title "Visualizzazione verticale"
@ 0,0 XBROWSE oBrw OF oDlgVista COLUMNS 1 HEADERS "Campi" ;
COLSIZES 140;
ARRAY aStruct CELL LINES NOBORDER SIZE -1,-20
ADD TO oBrw DATA (cdbf)->(FieldGet(oBrw:nArrayAt)) TITLE "Valori"
oBrw:aCols[ 1 ]:bEditValue := { ||aTitles[ oBrw:nArrayAt ] }
oBrw:aCols[ 1 ]:nWidth := 200
oBrw:aCols[ 2 ]:nWidth := 300
oBrw:CreateFromCode()
@ 230, 193 BUTTON oBtn PROMPT "&Uscita" OF oDlgVista SIZE 40, 15;
PIXEL ACTION oDlgVista:end()
ACTIVATE DIALOG oDlgVista center
return nil