// Class TXBrowse group headers demo
#include "FiveWin.ch"
#include "XBrowse.ch"
REQUEST DBFCDX
FUNCTION Main()
LOCAL oWnd, oBar, oFont
SET DATE ITALIAN
SET CENTURY ON
rddSetDefault( 'DBFCDX' )
DEFINE FONT oFont NAME 'TAHOMA' SIZE 0, - 12
DEFINE WINDOW oWnd MDI ;
TITLE "Testing GroupHeaders support for xBrowse"
oWnd:SetFont( oFont )
DEFINE BUTTONBAR oBar OF oWnd 2007
DEFINE BUTTON OF oBar FILE "..\bitmaps\16x16\exit.bmp" ACTION ( oWnd:End() )
DEFINE BUTTON OF oBar FILE "..\bitmaps\16x16\New.bmp" ACTION ( TestHeader() )
ACTIVATE WINDOW oWnd MAXIMIZED
RELEASE FONT oFont
RETURN NIL
FUNCTION TestHeader()
LOCAL oWnd, oBrw, oBold, cClrBack
LOCAL cAlias := cGetNewAlias( 'CUST' )
USE CUSTOMER NEW SHARED ALIAS ( cAlias )
DEFINE FONT oBold NAME 'VERDANA' SIZE 0, - 14 BOLD
DEFINE WINDOW oWnd MDICHILD OF WndMain()
@ 0, 0 XBROWSE oBrw OF oWnd ;
COLUMNS 'First', 'Last', 'Street', 'City', 'State', ;
'Zip', 'HireDate', 'Married', 'Age' ;
COLSIZES 100, 100, 100, 100 ;
ALIAS cAlias CELL LINES ;
FOOTERS AUTOSORT
/* HEADERS 'First' + CRLF + 'Name', 'Last' + CRLF + 'Name' */ ;
/* // original
WITH OBJECT oBrw
:SetGroupHeader( 'EMPLOYEE' + CRLF + 'NAME', 1, 2, oBold )
:SetGroupHeader( 'ADDRESS', 3, 6, oBold )
:SetGroupHeader( 'OTHER', 8, 9, oBold )
:Married:SetCheck()
:nStretchCol := :Street:nCreationOrder
END
*/
// Armando:
WITH OBJECT oBrw
:l2007 := .F.
:lHScroll := .F.
:lVScroll := .F.
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:nStretchCol := STRETCHCOL_WIDEST
:nHeaderHeight := 25
:nRowHeight := 22
:nFooterHeight := 25
:bClrHeader := {|| { CLR_WHITE, CLR_BLACK } }
:bClrFooter := {|| { CLR_WHITE, CLR_BLACK } }
// Armando
// :bClrSel := {|| IF( oApp:KeyNo % oApp:nRowsInt == 0, { CLR_BLACK, oApp:nRowParClr }, { CLR_BLACK, oApp:nRowNonClr } ) }
:bClrSel = { || { If( ( oBrw:cAlias )->( Deleted() ), CLR_BLACK, CLR_WHITE ),;
RGB( 34, 177, 76 ) } } //RGB( 0x33, 0x66, 0xCC ) } }
cClrBack = Eval( oBrw:bClrSelFocus )[ 2 ]
// Armando
// :bClrSelFocus := {|| { oApp:nFClrFocus, oApp:nBClrFocus } }
:bClrSelFocus := { || { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_WHITE ),;
cClrBack } }
// Armando
// :bClrStd := {|| IF( oBrw:KeyNo % oApp:nRowsInt == 0, { CLR_BLACK, oApp:nRowParClr }, { CLR_BLACK, oApp:nRowNonClr } ) }
:bClrStd = { || If( oBrw:KeyNo() % 2 == 0, ;
{ If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLUE ),;
RGB( 198, 255, 198 ) }, ;
{ If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLUE ),;
RGB( 232, 255, 232 ) } ) }
// Armando
// :nRecSelColor := oApp:nRowParClr //???
:nRecSelColor := nRgb( 245,244,234)
:lDisplayZeros := .F.
:blDblClick := {| nRow, nCol, nKey | Editar( oBrw, ( .F. ) ) }
:bKeyDown := {| nKey, nFlags | iif( nKey == VK_RETURN, Editar( oBrw, .F. ), ) }
WITH OBJECT :aCols[ 01 ]
:cOrder := "A"
END
END
// original
AEval( oBrw:aCols, {| o | o:nHeadStrAlign := AL_CENTER } )
// original
/*
WITH OBJECT oBrw:aCols[ 6 ]
:AddBmpFile( '..\bitmaps\mail.bmp' )
:nGrpBmpNo := 1
END
*/
/* // original
oBrw:bRClicked := {|| oBrw:SetGroupHeader( 'CITY', 5, 6, oBold ) }
oBrw:lAllowColReGroup := .T.
*/
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT oBrw:SetFocus() ;
VALID( oBold:End(), .T. )
RETURN NIL
FUNCTION Editar( oBrw, lEdit )
RETURN NIL
// fin / end