#include "fivewin.ch"
#include "xbrowse.ch"
Function Main()
Local oWndMain,oBar
DEFINE WINDOW oWndMain ;
TITLE "TEST"
SET MESSAGE OF oWndMain TO "TEST" CENTER NOINSET
DEFINE BUTTONBAR oBar _3D SIZE 44, 46 OF oWndMain
DEFINE BUTTON OF oBar ;
RESOURCE "BB1" ;
ACTION TEST(oWndMain,oBar)
ACTIVATE WINDOW oWndMain maximized
return nil
//-------------------------------------------------//
function Test(oWndMain,oBar)
local oDlg, oGrid, oFont,oCont,oTab,oSplit
Local aClient := GetClientRect (oWndMain:hWnd )
Local nSplit := 102
Local nGridBottom,nGridRight
USE CUSTOMER ALIAS CU
DEFINE DIALOG oDlg
oDlg:nTop = oBar:nHeight
oDlg:nLeft = 0
oDlg:nBottom = aClient[3] - 1
oDlg:nRight = aClient[4]
oDlg:nStyle := nOR( WS_CHILD, 4 )
oDlg:SetColor( CLR_WHITE, GetSysColor(15) )
nGridRight := (oDlg:nRight / 2 )
nGridBottom:= (oDlg:nBottom / 2) - oBar:nHeight
nOrder := 1
oGrid := TXBrowse():New( oDlg )
oGrid:nTop := 00
oGrid:nLeft := nSplit+2
oGrid:nBottom := nGridBottom
oGrid:nRight := nGridRight
aBrowse := { { { || CU->FIRST }, i18n("Nombre"), 150, 0 },;
{ { || CU->LAST }, i18n("Appellidos"), 150, 0 },;
{ { || CU->STREET}, i18n("Direccion"), 150, 0 },;
{ { || CU->CITY } , i18n("Localidad"), 150, 0 } }
FOR i := 1 TO Len(aBrowse)
oCol := oGrid:AddCol()
oCol:bStrData := aBrowse[ i, 1 ]
oCol:cHeader := aBrowse[ i, 2 ]
oCol:nWidth := aBrowse[ i, 3 ]
oCol:nDataStrAlign := aBrowse[ i, 4 ]
oCol:nHeadStrAlign := aBrowse[ i, 4 ]
NEXT
oGrid:SetRDD()
oGrid:CreateFromCode()
oGrid:bChange := { || RefreshCont(oCont,"CU") }
@ 0, 0 FOLDER oCont OF oDlg SIZE nSplit-10, nGridBottom PIXEL ;
PROMPT "Dati","Rapporti commerciali","Varie"
//@ 130,45 button "test for dialog" of oCont:adialogs[1] action Dialog_1( .t. ) PIXEL
@ nGridBottom, nSplit+2 TABS oTab ;
OPTION nOrder SIZE oWndMain:nWidth()-80, 12 PIXEL OF oDlg ;
ITEMS i18n(' First '), i18n(' Last ')
oSplit := TSplitter():New(00,nSplit,(.not..F.) .or. .T.,{oCont},.not..F.,;
{oGrid,oTab},.not..F., , ,;
oDlg,,1,nGridBottom + oTab:nHeight,;
.T.,.T.,,.F.,.T.,.T. )
ACTIVATE DIALOG oDlg NOWAIT ;
ON INIT RefreshCont( oCont,"CU")
return nil
FUNCTION RefreshCont( oCont,cdbf)
local nRecPtr :=(cdbf)->(RecNo())
local nOrden := (cdbf)->(OrdNumber())
LOCAL cFirst
LOCAL cLast
LOCAL cStreet
LOCAL cCity
LOCAL cState
LOCAL cZip
LOCAL dHiredate
LOCAL lMarried
LOCAL nAge
LOCAL nSalary
LOCAL cNotes
Local oDlg := oCont:adialogs[1]
Local oFont
cFirst := (cdbf)->FIRST
cLast := (cdbf)->LAST
cStreet := (cdbf)->STREET
cCity := (cdbf)->CITY
cState := (cdbf)->STATE
cZip := (cdbf)->ZIP
dHiredate := (cdbf)->HIREDATE
lMarried := (cdbf)->MARRIED
nAge := (cdbf)->AGE
nSalary := (cdbf)->SALARY
cNotes := (cdbf)->NOTES
DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8
@ 12, 10 SAY "First:" OF oDlg SIZE 14, 8 PIXEL FONT oFont
@ 10, 43 GET cFirst OF oDlg SIZE 105, 12 PIXEL FONT oFont
@ 26, 10 SAY "Last:" OF oDlg SIZE 14, 8 PIXEL FONT oFont
@ 24, 43 GET cLast OF oDlg SIZE 105, 12 PIXEL FONT oFont
@ 40, 10 SAY "Street:" OF oDlg SIZE 19, 8 PIXEL FONT oFont
@ 38, 43 GET cStreet OF oDlg SIZE 155, 12 PIXEL FONT oFont
@ 54, 10 SAY "City:" OF oDlg SIZE 13, 8 PIXEL FONT oFont
@ 52, 43 GET cCity OF oDlg SIZE 155, 12 PIXEL FONT oFont
@ 68, 10 SAY "State:" OF oDlg SIZE 17, 8 PIXEL FONT oFont
@ 66, 43 GET cState OF oDlg SIZE 15, 12 PIXEL FONT oFont
@ 82, 10 SAY "Zip:" OF oDlg SIZE 11, 8 PIXEL FONT oFont
@ 80, 43 GET cZip OF oDlg SIZE 55, 12 PIXEL FONT oFont
@ 96, 10 SAY "Hiredate:" OF oDlg SIZE 28, 8 PIXEL FONT oFont
@ 94, 43 GET dHiredate OF oDlg SIZE 44, 12 PIXEL FONT oFont
oCont:refresh()
RETURN nil