Navigation:  Classes > bBrowser >

bBrowser:RecordGroup

Print this Topic    Previous pageReturn to chapter overviewNext page

Purpose

Record groups with that the records are grouped in the bBrowser.

Class

bBrowser

Type

Access

Data Type

bRecordGroup

Description

With the definition of record groups the records can be shown grouped in the bBrowser. It is prerequisite that the records are sorted by the group characteristic. The records are automatically assigned to the defined record groups when the data server was skipped.

 

The record groups can be expanded and collapsed in the record group column with the mouse. Record groups can in addition be opened with the accelerator key STRG + '+' and closed with accelerator key STRG + '-'.

 

RecordGroupsInBrowser

bBrowser with record groups

 

The record group column is shown automatically if record groups are defined. An info value can be shown within the record group column for any defined record group level (see also bRecordGroupLevel). The info value can be defined with the access bRecordGroupLevel:GroupInfo.

 

RecordGroupInfo

bBrowser with record groups and info values

 

If the data server does not contain any records for group headers then virtual group headers can be defined with the access bRecordGroupLevel:GroupHeader. A virtual group header extends over the entire width of a data row. The group header can be configured with the option BRGHO_SCROLLHORIZONTAL that it also is scrolled when the data in the bBrowser is scrolled horizontally. As default the group header is not scrolled horizontally.

 

RecordGroupHeader

bBrowser with record groups and virtual group headers

 

Remarks

After record groups were defined in the bBrowser, the method bBrowser:Recalculate() must be invoked. Provided that a data server is already linked to the bBrowser, the method bBrowser:Refresh() must also be invoked.

Samples

In the following example a record group is defined with that the last names are grouped alphabetically according to the first letter. It is presupposed that the bBrowser is already initialized and an the current index in the data server is on field LASTNAME.

 

LOCAL oBrowser           AS bBrowser
LOCAL oRecordGroupLevel  AS bRecordGroupLevel
LOCAL cGroupKey          AS STRING
LOCAL ocbGroupHeader     AS bCodeblock
LOCAL oGroupHeader       AS bRecordGroupHeader
LOCAL oFont              AS Font
LOCAL oGrid              AS bGrid
 
// Initialize record groups
oBrowser:RecordGroup:LevelList:Clear()
 
// Record Group: Initializing Level 1
cGroupKey := "SubStr(Server:LASTNAME, 1, 1)"
oRecordGroupLevel := bRecordGroupLevel{bCodeblock{cGroupKey, oBrowser:Server},;
                                       ,;
                                       NIL,;
                                       _Or(BRGLO_AUTOOPEN, BRGLO_GROUPLEASH, BRGLO_SERVERSEEK)}
oRecordGroupLevel:GroupRowHeight := 24
 
ocbGroupHeader := bCodeblock{"Last name ' + SubStr(Server:LASTNAME, 1, 1)",;
                             oBrowser:Server}
oGroupHeader := bRecordGroupHeader{ocbGroupHeader}
oRecordGroupLevel:GroupHeader := oGroupHeader
 
oGrid := bGrid{BGRID_OUTLINEHORIZONTAL, , , , , Color{COLORBLACK}}
oFont := self:oDCBrowser:GetDefaultFont()
oFont:Bold := True
oRecordGroupLevel:GroupView := bViewStyle{ ,;
                                           ,;
                                           BALIGN_LEFT + BALIGN_BOTTOM,;
                                           oFont,;
                                           oGrid}
 
oBrowser:RecordGroup:LevelList:Add(oRecordGroupLevel)
 
// Record Group: Recalculate the bBrowser and refresh the data
// so that the record group levels are regard
oBrowser:Recalculate()
oBrowser:Refresh()

See Also

bBrowser:Recalculate()

bBrowser:Refresh()

bCodeblock

bGrid

bSample - RecordGroups

bRecordGroupHeader

bRecordGroupLevel

bViewStyle

 


Page url: http://www.YOURSERVER.com/index.html?bbrowser_recordgroup.htm