#include "fivewin.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
local oRec
SetGetColorFocus()
SET DATE ITALIAN
SET CENTURY ON
RDDSETDEFAULT( "DBFCDX" )
USE CUSTOMER NEW SHARED
GOTO 10 // any record to be edited
oRec := TDataRow():New( "CUSTOMER" )
EditDialog( oRec )
CLOSE DATA
return nil
function EditDialog( oRec )
local oDlg, oFont, oBold, oPanel
local lNew := ( oRec:RecNo == 0 )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-14 BOLD
DEFINE DIALOG oDlg SIZE 500,400 PIXEL TRUEPIXEL FONT oFont ;
TITLE "FWH TScrollPanel"
@ 20,20 SAY If( oRec:RecNo == 0, "ADD CUSTOMER", "EDIT CUSTOMER : " + STRZERO( oRec:RecNo, 3 ) ) ;
SIZE 460,24 PIXEL OF oDlg CENTER UPDATE FONT oBold
//
oPanel := TScrollPanel():New( 60, 20, 300, 480, oDlg, .t. )
oPanel:SetFont( oDlg:oFont )
//
@ 340,020 BUTTON "SAVE" SIZE 100,40 PIXEL OF oDlg ACTION ( oRec:Save(), oDlg:End() )
@ 340,380 BUTTON "CANCEL" SIZE 100,40 PIXEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED ON INIT ( PlaceControls( oPanel, oRec ) ) ;
ON PAINT oDlg:Box( 59, 19, 302, 490 )
RELEASE FONT oFont, oBold
return nil
function PlaceControls( oPanel, oRec )
local nRow := 30
@ nRow, 20 SAY "First :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:First SIZE 300,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "Last :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:Last SIZE 300,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "Street :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:Street SIZE 300,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "City :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:City SIZE 300,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "State :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:State SIZE 300,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "Zip :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:Zip SIZE 300,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "HireDate :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:HireDate SIZE 300,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "Married :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 CHECKBOX oRec:Married PROMPT "" SIZE 24,24 PIXEL OF oPanel
nRow += 30
@ nRow, 20 SAY "Age :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:Age SIZE 040,24 PIXEL OF oPanel PICTURE "99" RIGHT
nRow += 30
@ nRow, 20 SAY "Salary :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:Salary SIZE 100,24 PIXEL OF oPanel PICTURE "999,999.99" RIGHT
nRow += 30
@ nRow, 20 SAY "Notes :" SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
@ nRow, 110 GET oRec:Notes SIZE 300,24 PIXEL OF oPanel
oPanel:SetRange() // call this after defining all controls
return nil