[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_DBECONFIG Database browse configuration structure
------------------------------------------------------------------------------
Declaration
database.hdr
Syntax
typedef struct _DBECONFIG
uint uTimeOut
char(1) cCharDel
char(1) cCharEmpty
byte bHeadRow
byte bHeadCol
byte bHeadLen
uint uKeyMark
uint uKeyUnMark
uint uKeyMarkAll
uint uKeyMarkClr
uint uKeyReload
enddef
Members
uTimeOut is the idle timeout value in seconds after which the browse
exits automatically. Default is 3600 seconds (1 hour). Set to 0 to
disable the timeout feature.
cCharDel is the character to mark deleted records (default "*").
cCharEmpty is the pad character for cell display (default " ").
bHeadRow is the header row (default 0).
bHeadCol is the header column (default 0).
bHeadLen is the header length (default 0).
uKeyMark is the record mark key (default K_INS).
uKeyUnMark is the record unmark key (default K_DEL).
uKeyMarkAll is the mark all records key (default K_ALT_INS).
uKeyMarkClr is the clear all marks key (default K_ALT_DEL).
uKeyReload is the database reload key (default K_ALT_L).
Description
The _DBECONFIG structure contains configuration information for a
database browse. The __dbecfg system variable is declared as of type
_DBECONFIG, and is used to configure the behavior of the dbedit()
function.
Example
#define EXAMPLE_TYPE
#define EXAMPLE_DATABASE
#include example.hdr
func uint KeyFunc5 static
para _ALIAS_PARAM pDbf, ;
value uint uField, ;
value ulong pBitArray, ;
value uint uMode
vardef
uint uMarked
uint n
enddef
uMarked := 0
for n := 1 to areccount( pDbf )
if barrget( pBitArray, n ) // calculate number of marked records
uMarked++
endif
next
@ 2, 11 ?? arecno( pDbf ) // status display
@ 2, 26 ?? uField
@ 2, 41 ?? uMarked
@ 2, 56 ?? uMode
return( DBER_CONTINUE )
endproc
func char HeaderFunc5 static // return column headers
param _ALIAS_PARAM pDbf, ;
value uint uField, ;
uint nFldLen
nFldLen := afieldlen( pDbf, uField ) // must always return a length
return( upper( afieldname( pDbf, uField ) ) )
endfunc
func char RecordFunc5 static // return record contents
param _ALIAS_PARAM pDbf, ;
value uint uField, ;
uint nFldLen
nFldLen := afieldlen( pDbf, uField ) // must always return a length
return( afieldstring( pDbf, uField ) )
endfunc
proc Test_DBECONFIG
vardef
uint n
_DBESET mBrw
ptr( _DBEDISP ) _aFuncRec[ NUM_FIELDS ]
ptr( _DBEDISP ) _aFuncHdr[ NUM_FIELDS ]
enddef
clear
cursor( .f. )
@ 23, 0 ?? center( "Use the (Back)Space keys to (un)mark records", 80 )
@ 24, 0 ?? center( "Idle exit time is 5 seconds", 80 )
@ 1, 15 ?? "Record"
@ 1, 30 ?? "Field"
@ 1, 46 ?? "Marked"
@ 1, 62 ?? "Mode"
__syscolor[ CLR_STD ] := WHITE_BLACK
@ 5, 14 ?? replicate( "-", 53 )
__syscolor[ CLR_DBE_STD ] := WHITE_BLUE // unmarked records
__syscolor[ CLR_DBE_SEL ] := BLUE_WHITE // selection bar
__syscolor[ CLR_DBE_CELL ] := BLACK_WHITE // selected cell
__syscolor[ CLR_DBE_MARKED ] := GREEN_BLACK // marked records
__syscolor[ CLR_DBE_HEAD ] := WHITE_BLACK // header
mBrw.uColumns := NUM_FIELDS
for n := 0 to NUM_FIELDS - 1 // fill function arrays
_aFuncHdr[ n ] := &HeaderFunc5
_aFuncRec[ n ] := &RecordFunc5
next
mBrw.bTop := 6 // browse settings
mBrw.bLeft := 14
mBrw.bBottom := 21
mBrw.bRight := 66
mBrw.pSepRec := &" "
mBrw.pSepHdr := &" "
mBrw.pKeyFunc := &KeyFunc5
__dbecfg.uTimeOut := 5 // set idle timeout
__dbecfg.cCharDel := "!" // set character to mark deleted records
__dbecfg.cCharEmpty := "#" // set pad character for cell display
__dbecfg.uKeyMark := K_SPACE // set record mark key
__dbecfg.uKeyUnMark := K_BS // set record unmark key
__syscolor[ CLR_STD ] := BLACK_LIGHT_GREY
open sTest // open database
!sTest delete all for sTest->lastname = "Canady" // delete some records
!sTest go top
dbedit( sTest, mBrw, &_aFuncRec[], &_aFuncHdr[] )
clear
cursor( .t. )
endproc
proc main
Test_DBECONFIG()
endproc
See Also: dbedit()
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson