@ 0,0 XBROWSE oBrw OF oWnd ;
FIELDS oBrw:aRow:PLU, oBrw:aRow:DESCRIP, oBrw:aRow:Cost, oBrw:aRow:qtyord, oBrw:aRow:extPrice ;
HEADERS "PLU", "Description","Cost","Qty","Total" ;
COLSIZES 50,140,70,70,70 ;
ARRAY aItems //;
//COLORS CLR_WHITE, CLR_BLUE
oBrw:nRowHeight := 25
//oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:lRecordSelector := .f.
oBrw:nStretchCol := STRETCHCOL_LAST
oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY
oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY
oBrw:lFastEdit := .T.
oBrw:CreateFromCode()
oBrw:aCols[4]:nEditType(1) // 1 is a GET
oBrw:aCols[4]:bOnPostEdit:= {|self,uData| …? } // Not working yet.
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local aItems := {}
local oCust, oDlg, oBrw, oFont, n
oCust := TDataBase():Open( nil, "CUSTOMER", "DBFCDX", .t. )
for n := 1 to 10
oCust:GoTo( n )
AAdd( aItems, oCust:record() )
next
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 800,400 PIXEL TRUEPIXEL FONT oFont ;
TITLE FWVERSION
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE aItems ;
COLUMNS "ID", "First", "City", "Age", "Salary" ;
HEADERS "ID", "FirstName", "Address", "Age", "Salary" ;
PICTURES "999" ;
CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
:bClrStd := { || { CLR_BLACK, GetSysColor( 15 ) } }
WITH OBJECT :Age
:nEditType := EDIT_GET
:bClrStd := { || { CLR_BLACK, CLR_WHITE } }
END
:bSaveData := { || oBrw:aRow:Save() } // You may change this for your TRecord class
:nColSel := oBrw:oCol( "Age" ):nCreationOrder
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
// Now, verify that the changes are actually written to the dbf
oCust:GoTop()
XBROWSER oCust
oCust:End()
return nil
//----------------------------------------------------------------------------//
Silvio.Falconi wrote:there is an error on FWVERSION
18.05 -------------->19.05
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local aItems := {}
local oCust, oDlg, oBrw, oFont, n
oCust := TDataBase():Open( nil, "CUSTOMER", "DBFCDX", .t. )
for n := 1 to 10
oCust:GoTo( n )
AAdd( aItems, oCust:record() )
next
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 800,600 PIXEL TRUEPIXEL FONT oFont ;
TITLE FWVERSION
@ 70,20 SAY "EDIT MAIN INVOICE BODY HERE" SIZE 760,24 PIXEL OF oDlg CENTER
@ 150,20 XBROWSE oBrw SIZE -20,-80 PIXEL OF oDlg ;
DATASOURCE aItems ;
COLUMNS "ID", "First", "City", "Age", "Salary" ;
HEADERS "ID", "FirstName", "Address", "Age", "Salary" ;
PICTURES "999" ;
CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
:bClrStd := { || { CLR_BLACK, GetSysColor( 15 ) } }
WITH OBJECT :Age
:nEditType := EDIT_GET
:bClrStd := { || { CLR_BLACK, CLR_WHITE } }
END
:nColSel := oBrw:oCol( "Age" ):nCreationOrder
//
:CreateFromCode()
END
@ 540, 20 BUTTON "SAVE" SIZE 150,30 PIXEL OF oDlg ;
ACTION ( AEval( aItems, { |o| o:Save() } ), oDlg:End() )
@ 540,200 BUTTON "CANCEL" SIZE 150,30 PIXEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
oCust:GoTop()
XBROWSER oCust
oCust:End()
return nil
//----------------------------------------------------------------------------//
Silvio.Falconi wrote:Nages,
I think that james refers to two dbf, for a sample Master.dbf Items.dbf
the two archives are linked by the invoice number (set scope to)
when the use open ( ord add new) a record of Master , the record must be lock and create an array for the items
the user can modify the array or add new rows
When the user save the procedue must save the record on Master and the Items on Items.dbf ( having the same invoice number)
and the unlock the record (of Master)
this is in theory but in practice how is it done with tdatabase ?
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 87 guests