#include "fivewin.ch"
#include "xbrowse.ch"
#define PIC "@Z 999,999.99"
#define LN_NO 1
#define LN_SELECT 2
function main()
local aFiledbf := { {1, .f., "PAY A", "CL601", "ACCRUALS - AUDIT FEE", transform(100, PIC)}, ;
{1, .f., "PAY B", "CL600", "ACCRUALS - OTHERS" , transform(200, PIC)}, ;
{1, .f., "Payee: PAYEE", "", "", transform(0, PIC)}, ;
{2, .f., "PAY C", "PD004", "ACCUM DEPRN. - MOTOR VEHICLE", transform(500, PIC)}, ;
{2, .f., "PAY D", "E0079", "ADT ALARM", transform(300, PIC)}, ;
{2, .f., "Payee: ADT ALARM", "", "", transform(0, PIC)}, ;
{3, .f., "PAY E", "PD001", "ACCUM DEPRN.", transform(150, PIC)}, ;
{3, .f., "Payee: SMITH", "", "", transform(0, PIC)} ;
}
local oDlg, oBrw
define dialog oDlg resource "recur" //font ofont
redefine xbrowse oBrw id 101 of oDlg ;
columns LN_NO, LN_SELECT, 3, 4, 5, 6 ;
headers "No", "", "Remarks", "Code", "Account", "Amount" ;
cell lines noborder ;
array aFiledbf ;
update
oBrw:nStretchCol := STRETCHCOL_WIDEST
oBrw:bKeyDown := { | nKey | FC_ONCHG( nKey, oBrw ) }
oBrw:bClrSel := {|| {CLR_BLACK, CLR_HGRAY} }
oBrw:bClrStd := {|| {CLR_BLACK, bckClr(oBrw)} }
aeval(oBrw:aCols,{|o| o:bLDClickData := { || FC_ONCHG( VK_RETURN, oBrw) }})
oBrw:aCols[2]:setCheck()
oBrw:No:lMergeVert := .t.
oBrw:aCols[2]:lMergeVert := .t.
redefine button id 102 of oDlg action oDlg:end()
activate dialog oDlg centered
return nil
//----------------------------------------------------------------------
function bckClr(oXbrw)
local aRow := oXbrw:aRow(), nRet := CLR_WHITE
if aRow[LN_SELECT]
nRet := nRGB(216, 76, 216)
else
if aRow[LN_NO] != nil
nRet := if(mod(aRow[LN_NO],2) == 0, 12706303, 16772310)
endif
endif
return nRet
//----------------------------------------------------------------------
procedure fc_onchg(nKey, oBrw)
local no, i
DO CASE
CASE nKey == VK_RETURN .or. nKey == VK_SPACE
no := oBrw:aRow()[LN_NO]
for i := 1 to len(oBrw:aArrayData)
if oBrw:aArrayData[i, LN_NO] == no
oBrw:aArrayData[i, LN_SELECT] := !oBrw:aArrayData[i, LN_SELECT]
endif
if oBrw:aArrayData[i, LN_NO] > no
exit
endif
next
oBrw:Refresh()
oBrw:SetFocus()
ENDCASE
return