// \samples\COLIN.PRG - Modificado en: 14/11/2021 - Joao.
#Include "FiveWin.ch"
#Include "xBrowse.ch"
#Define TRUE .T.
#Define FALSE .F.
FUNCTION Main()
LOCAL oWnd, oBrw, oCol
REQUEST DBFCDX
USE Colin NEW SHARED VIA "DBFCDX"
DEFINE WINDOW oWnd TITLE "Class TXBrowse example"
SET MESSAGE OF oWnd TO FWVERSION + ", " + FWCOPYRIGHT CENTERED TIME DATE
@ 0, 0 XBROWSE oBrw OF oWnd ALIAS Alias()
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := TRUE
oBrw:lFastEdit := TRUE
oBrw:nDatalines := 1
oBrw:nRowHeight := 24
// AQUI:
oBrw:lHScroll := TRUE // FALSE
oBrw:lVScroll := TRUE // FALSE
oBrw:lFooter := TRUE
oBrw:bChange := {|| oBrw:MakeTotals(), oBrw:Refresh() }
// oBrw:nStretchCol := STRETCHCOL_LAST
oBrw:bClrSel := {|| { CLR_WHITE, CLR_BLUE } }
oBrw:MakeTotals()
oCol := oBrw:AddCol()
oCol:cHeader := "Code"
oCol:nWidth := 50
oCol:cEditPicture := '@!'
oCol:bEditValue := {|| Colin->CODE }
oCol:nDataStyle := oCol:DefStyle( AL_LEFT, .T. )
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := {| o, v | RLock(), Colin->CODE := v, dbCommit(), ;
dbUnlock(), oBrw:Refresh(), oBrw:SetFocus() }
oCol := oBrw:AddCol()
oCol:cHeader := "Description"
oCol:nWidth := 220
oCol:cEditPicture := '@'
oCol:bEditValue := {|| Colin->DESC }
oCol:nDataStyle := oCol:DefStyle( AL_LEFT, .T. )
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := {| o, v | RLock(), Colin->DESC := v, dbCommit(), ;
dbUnlock(), oBrw:Refresh(), oBrw:SetFocus() }
oCol := oBrw:AddCol()
oCol:cHeader := "Qty"
oCol:nWidth := 45
oCol:cEditPicture := '9999'
oCol:bEditValue := {|| Colin->qty }
oCol:nDataStyle := oCol:DefStyle( AL_RIGHT, .T. )
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := {| o, v | RLock(), Colin->qty := v, dbCommit(), ;
dbUnlock(), oBrw:Refresh(), oBrw:SetFocus() }
oCol := oBrw:AddCol()
oCol:cHeader := "Cost"
oCol:nWidth := 60
// oCol:cEditPicture := '999999.99'
oCol:cEditPicture := '€999999.99 '
oCol:bEditValue := {|| Colin->cost }
oCol:nDataStyle := oCol:DefStyle( AL_RIGHT, .T. )
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := {| o, v | RLock(), Colin->cost := v, ;
Colin->charge := Colin->cost * ;
Colin->qty, dbCommit(), dbUnlock(), ;
oBrw:MakeTotals(), oBrw:Refresh(), oBrw:SetFocus() }
oCol:lTotal := TRUE
oCol:nTotal := 0
oCol := oBrw:AddCol()
oCol:cHeader := "Charget"
oCol:nWidth := 60
oCol:cEditPicture := '999999.99'
oCol:bEditValue := {|| Colin->charge }
oCol:nDataStyle := oCol:DefStyle( AL_RIGHT, .T. )
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := {| o, v | RLock(), Colin->charge := v, dbCommit(), ;
dbUnlock(), oBrw:Refresh(), oBrw:SetFocus() }
oCol:lTotal := TRUE
oCol:nTotal := 0
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT( oBrw:MakeTotals(), CLRTEST( CLR_WHITE, CLR_WHITE ) )
RETURN NIL
// COLORES EN WINDOW -FUNCIONA-- +-
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( CLRTEST )
{
int aElements[2] = { COLOR_CAPTIONTEXT, COLOR_ACTIVECAPTION };
DWORD aColors[2];
aColors[ 0 ] = hb_parnl( 1 );
aColors[ 1 ] = hb_parnl( 2 );
SetSysColors( 2, aElements, aColors );
}
#pragma ENDDUMP
// ???
/*
DLL32 Function SetSysColors ( nChanges As LONG, lpSysColor As LONG, lpColorValues As LONG) As LONG ;
PASCAL FROM "SetSysColors" Lib "user32"
*/