Copyright: © 2001 Core Lab


Compatibility
CRControls

Compatibility

Following IDE are supported by CRControls: Delphi 2007, Borland Developer Studio 2006, Delphi 2005, Delphi 8, 7, 6 and 5, C++ Builder 6 and 5.

CRControls does not support Kylix.


Support
CRControls

Support

CRControls components are no longer supported by Core Lab. All registered users of ODAC, MyDAC, SDAC and IBDAC have source code of CRControls components, so you can edit them as you like.


Description

TCRColumn

Hierarchy	Properties	Methods

Unit

CRGrid

Description

TCRDBGrid component uses TCRColumn for its Columns collection property. TCRColumn is tailored to provide extended functionality (statistical information, multiple sorting and sizing) for the TCRDBGrid.

See Also

TCRDBGrid


FilterExpression
TCRColumn.FilterExpression

TCRColumn

property FilterExpression: string;

Description

Use FilterExpression property to specify conditional string statement which is used to filter out only a subset of records. Statement must comply with the associated field type or otherwise an exception is raised.

Once set filtering will be seen for all data-aware components which are associated with the dataset that provides values for the column.

For examples of valid conditional statements see Using Filter Bar topic.

See Also

TCRDBGrid.OptionsEx


FloatDigits
TCRColumn.FloatDigits

TCRColumn

property FloatDigits: integer;

Description

Use FloatDigits property for formatting of numerical values of summary information in the status bar. FloatDigits and FloatFormat parameters control together how the value is formatted into a string. For details, see the description of TFloatFormat. This property has an influence on status bar representation only.

See Also

FloatFormat

FloatPrecision


FloatFormat
TCRColumn.FloatFormat

TCRColumn

type

  TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);

property FloatFormat: TFloatFormat;

Description

Use FloatFormat property for formatting of numerical values of summary information in the status bar. TFloatFormat defines an enumerated list of formatting codes for the float functions. This property has an influence on status bar representation only.

See Also

FloatDigits

FloatPrecision


FloatPrecision
TCRColumn.FloatPrecision

TCRColumn

property FloatPrecision: integer;

Description

Use FloatPrecision property for formatting of numerical values of summary information in the status bar. The FloatPrecision parameter specifies the precision of the given value. It should 18 or less for values of type Extended. This property has an influence on status bar representation only.

See Also

FloatDigits

FloatFormat


SortOrder
TCRColumn.SortOrder

TCRColumn

type

  TSortOrder = (soNone, soAsc, soDesc);

property SortOrder: TSortOrder;

Description

SortOrder property is used to set the sorting order for the values of the column. Assign soAsc value to make all values be sorted in ascending order, or soDesc value to sort them in descending order.

Default value is smNone.

Note:	SortOrder works in context of SortSequence property. If non-zero value is assigned to SortSequence then multiple sorting is assumed for the dataset and column values are arranged based on the other column having lower SortSequence.

See Also

SortSequence


SortSequence
TCRColumn.SortSequence

TCRColumn

property SortSequence: integer;

Description

SortSequence property specifies sorting level which is applicable to the column when sorting is requested across multiple fields of the associated dataset. Most major column in sorting hierarchy is assigned zero sorting order. If two or more field values of the column with lower SortSequence are equal then column with higher SortSequence will arrange records based on sorting of its own values.

See Also

SortMode


SummaryMode
TCRColumn.SummaryMode

TCRColumn

type

  TSummaryMode = (smNone, smSum, smAvr, smMax, smMin);

property SummaryMode: TSummaryMode;

Description

SummaryMode property specifies what kind of statistical information on column values is displayed in the status bar of associated TCRDBGrid component.

For this property to work include dgeSummary option into TCRDBGrid.OptionsEx property.

Following values are supported for the SummaryMode:

Value	Meaning

smNone (default)	No statistics is displayed.

smSum	Sum of column values is displayed.

smAvr	Average of column values is displayed. That is sum of column values divided by total number of records.

smMax	Maximum column value is displayed.

smMin	Minimum column value is displayed.

See Also

TCRDBGrid.OptionsEx


TotalString
TCRColumn.TotalString

TCRColumn

property TotalString: string;

Description

TotalString property is used to get string value of column's statistical information that is displayed on status bar of associated TCRDBGrid component.

See Also

TotalValue


TotalValue
TCRColumn.TotalValue

TCRColumn

property TotalValue: Variant;

Description

TotalValue property is used to get value of column's statistical information that is displayed on status bar of associated TCRDBGrid component.

See Also

TotalString


Description

 TCRDBGrid

Hierarchy	Properties	Methods	Events

Unit

CRGrid

Description

TCRDBGrid component addresses extended functionality commonly not found in TDBGrid component.

Following picture summarizes capabilities of TCRDBGrid component:

Use TCRDBGrid component to add the following features to your existing projects with TDBGrid already in them:

•	Proportional sizing and stretching of columns so that they cover entire grid area.

•	Visual feedback when cell is not wide enough to display the whole value. In this case either partial value with ellipsis or a sharp ('#') sign is displayed as a substitute.

•	Status bar for total record number and summary statistics.

•	Multilevel nested column headers.

•	Column sizing command to fit every cell value for that column (double-click column headers separator to size associated column).

•	Multiple sorting on selected columns (hold SHIFT down while clicking column headers to set multiple sorted columns; hold CTRL down and click columns area to remove sorting).

•	Memo fields are allowed for editing.

•	Search bar.

•	Filter bar.

See Also

TCRColumn

Using Filter Bar

Using Search Bar

TDBGrid


Filtered
TCRDBGrid.Filtered

TCRDBGrid

property Filtered: boolean;

Description

Set Filtered property to specify whether record entries are filtered according to the conditional statements of individual columns or not.

Conditional statements of all columns are combined to form a single filter.


LevelDelimiterChar
TCRDBGrid.LevelDelimiterChar

TCRDBGrid

property LevelDelimiterChar: char;

Description

Set LevelDelimiterChar to set the character symbol which TCRDBGrid looks for in column captions to resolve multilevel nested columns.


Columns
TCRDBGrid.Columns

TCRDBGrid

property Columns: TDBGridColumns;

Description

Columns property manages a collection of columns for the TCRDBGrid component.

Note:	To provide extended functionality TCRDBGrid component is shipped with a TCRColumn class, which is derived from the standard TColumn class but is tailored to work with TCRDBGrid only.

When browsing TDBGridColumns remember that its Items property actually returns TCRColumn objects when indexed.

See Also

TCRColumn


OptionsMenu
TCRDBGrid.OptionsMenu

TCRDBGrid

property OptionsMenu: TPopupMenu;

Description

TCRDBGrid has local menu is situated in the left upper corner. Standard menu has items to show or hide filter bar and search bars. User can change content of this menu using OptionsMenu property.


OptionsEx
TCRDBGrid.OptionsEx

TCRDBGrid

type

  TCRDBGridOptionEx = (dgeEnableSort, dgeFilterBar, dgeLocalFilter, dgeLocalSorting, dgeRecordCount,

    dgeSearchBar, dgeStretch, dgeSummary);

  TCRDBGridOptionsEx = set of TCRDBGridOptionEx;

property OptionsEx: TCRDBGridOptionsEx;

Description

OptionsEx property provides control over TCRDBGrid-specific features. They complement inherited options found in Options property.

Following values are supported for the OptionsEx set:

Value	Meaning

dgeEnableSort	Enables sorting of records by the specified column clicking on the column title.

dgeFilterBar	Shows filter bar below grid caption where filter expressions for every column are entered manually.

dgeLocalFilter	Records are filtered using associated dataset component facilities. Otherwise database server processes all filter operations.

dgeLocalSorting	Records are sorted using associated dataset component facilities. Otherwise database server processes all sorting operations.

dgeRecordCount	Displays status bar with current record number in respect to the total number of records. This option is mutually exclusive with dgeSummary option.

dgeSearchBar	Shows search bar below grid caption where incremental search expression is entered for every column.

dgeStretch	Makes all columns adjust their widths so that they fin onto entire grid area.

dgeSummary	Displays status bar with summary information for every column. See TCRColumn.SummaryMode property on description of available options for individual columns.  dgeSummary is mutually exclusive with dgeRecordCount option.


ActivateFilterEdit
TCRDBGrid.AdjustColumns

TCRDBGrid

procedure ActivateFilterEdit(Column: TColumn);

Description

Use ActivateFilterEdit at run-time to move input focus to the filter bar. It activates edit control that belongs to the column, specified by Column property.

See Also

ActivateSearchEdit


ActivateSearchEdit
TCRDBGrid.ActivateSearchEdit

TCRDBGrid

procedure ActivateSearchEdit(Column: TColumn);

Description

Use ActivateSearchEdit at run-time to move input focus to the search bar. It activates edit control that belongs to the column, specified by Column property.

See Also

ActivateFilterEdit


AdjustColumns
TCRDBGrid.AdjustColumns

TCRDBGrid

procedure AdjustColumns;

Description

Call AdjustColumns method at run-time to stretch all columns in a grid so that they become wide enough to accommodate every visible field value.

Widths of column captions restrict minimum column sizes for this operation.


ApplyFilter
TCRDBGrid.ApplyFilter

TCRDBGrid

procedure ApplyFilter;

Description

Call ApplyFilter method at run-time to update TCRDBGrid component taking into account filter statements defined for every column. Visual feedback is immediate if OptionsEx property includes dgeLocalFilter option.

Note:	Since filtering is performed at session level then other data-aware controls may also be updated.


CalcTitleLevel
TCRDBGrid.CalcTitleLevel

TCRDBGrid

procedure CalcTitleLevel(Level: integer; var aRect: TRect);

Description

Call CalcTitleLevel method to set Top and Bottom values of aRect parameter record depending on Level parameter value.


ClearFilters
TCRDBGrid.ClearFilters

TCRDBGrid

procedure ClearFilters;

Description

Call CalcFilters method to clear all filter statements for grid columns.


ClearSorting
TCRDBGrid.ClearSorting

TCRDBGrid

procedure ClearSorting;

Description

Call ClearSorting method to discard sorting previously applied to the grid data.


DataChanged
TCRDBGrid.DataChanged

TCRDBGrid

procedure DataChanged;

Description

Call DataChanged method to update displayed data and status information for the grid.


GetGridSize
TCRDBGrid.GetGridSize

TCRDBGrid

function GetGridSize: integer;

Description

Call GetGridSize method to obtain width of a client area for the grid component.

Client area accommodates cell values only without column grid lines.


GetTitleLevel
TCRDBGrid.GetTitleLevel

TCRDBGrid

function GetTitleLevel(Level: integer): TRect;

Description

GetTitleLevel method returns TRect structure filled with top and bottom coordinates for the specified title level.


OnGetCellParams
TCRDBGrid.OnGetCellParams

TCRDBGrid

type

  TGridDrawState = set of (gdSelected, gdFocused, gdFixed);

  TGridDrawStateEx = set of (geHighlight, geActiveRow, geMultiSelected);

  TGetCellParamsEvent = procedure (Sender: TObject; Field: TField;

    AFont: TFont; var Background: TColor; State: TGridDrawState;

    StateEx: TGridDrawStateEx) ofobject;

property OnGetCellParams: TGetCellParamsEvent;

Description

Write an OnGetCellParams event handler to provide custom background colors while the grid redraws individual cells.


OnMemoClick
TCRDBGrid.OnMemoClick

TCRDBGrid

type

  TOnMemoClick = procedure (Sender: TObject; Column: TColumn) ofobject;

property OnMemoClick: TOnMemoClick;

Description

Write an OnMemoClick event handler to provide custom processing of Memo fields instead of built-in Memo field editor.


Using Filter Bar
Using Filter Bar of TCRDBGrid Component

TCRDBGrid

Filter bar is used at run-time to provide interactive selection of records which satisfy conditional statements entered manually by the user for columns of the grid.

To make filter bar available first set dgeFilterBar option in OptionsEx property or select Filter Bar item from the popup menu. This turns TCRDBGrid component look like the following:

Now for every column you may specify filter statement which is of the form:

   [<RELATIONAL SIGN>]<STATEMENT>

where relational sign is one of the following =, <>, <, >, <=, >=.

Omitting relational sign has the same effect as using equal sign ('=').

Statement is any alphanumerical text which is of a valid data type allowed for the corresponding field. For fields which accept string values you may specify filter mask in the statement substituting masked characters with an asterisk or percent ('*' or '%') symbol . To substitute a single character use underscore ('_') mask symbol.

For example given these filter statements

   >20  for DEPTNO column,

   <>T*T2  for DNAME column,

filtered records will leave our grid example look like this:

To temporarily abandon filtering of the dataset left-click on menu icon and from popup select Filtered option. Doing the same afterwards will restore filtering.

See Also

TCRColumn.FilterExpression


Using Search Bar
Using Search Bar of TCRDBGrid Component

TCRDBGrid

Search bar is used at run-time to provide interactive search option for a specific record.

To make search bar available first set dgeSearchBar option in OptionsEx property or turn on Search Bar item from a popup menu. This makes TCRDBGrid component look like the following:

Now select column and start typing leading characters of the record you want to locate in the grid. TCRDBGrid positions cursor to the nearest match found in dataset.


Hierarchy

TObject

TPersistent

TCollectionItem

TColumn


Hierarchy

TObject

TPersistent

TComponent

TControl

TWinConrol

TCustomControl

TCustomGrid

TCustomDBGrid


   Scope

     Published

   Accessibility

     Read-only


TCRDBGrid properties

TCRDBGrid	Legend

In TCRDBGrid

			Columns
			Filtered
			LevelDelimiterChar
			OptionsEx
			OptionsMenu

Derived from TCustomDBGrid

			DataSource
			DefaultDrawing
			FieldCount
			Fields
			Options
			ReadOnly
			SelectedField
			SelectedIndex
			SelectedRows
			TitleFont

Derived from TCustomGrid

			BorderStyle
			Col
			EditorMode
			FixedColor
			LeftCol
			Row
			TopRow

Derived from TCustomControl

			Canvas

Derived from TWinControl

			AlignDisabled
			Brush
			ClientOrigin
			ClientRect
			ControlCount
			Controls
			Ctl3D
			DockClientCount
			DockClients
			DoubleBuffered
			Handle
			ImeMode
			ImeName
			ParentCtl3D
			ParentWindow
			Showing
			TabOrder
			TabStop
			VisibleDockClientCount

Derived from TControl

			Action
			Align
			Anchors
			BiDiMode
			BoundsRect
			ClientHeight
			ClientWidth
			Color
			Constraints
			ControlState
			ControlStyle
			Cursor
			DockOrientation
			DragCursor
			DragKind
			DragMode
			Enabled
			Floating
			FloatingDockSiteClass
			Font
			Height
			HelpContext
			HelpKeyword
			HelpType
			Hint
			HostDockSite
			Left
			LRDockWidth
			Name
			Parent
			ParentBiDiMode
			ParentColor
			ParentFont
			ParentShowHint
			PopupMenu
			ShowHint
			TBDockHeight
			Top
			UndockHeight
			UndockWidth
			Visible
			Width
			WindowProc

Derived from TComponent

			ComObject
			ComponentCount
			ComponentIndex
			Components
			ComponentState
			ComponentStyle
			DesignInfo
			Owner
			Tag
			VCLComObject


TCRDBGrid methods

TCRDBGrid

In TCRDBGrid

	AdjustColumns
	ApplyFilter
	CalcTitleLevel
	ClearFilters
	ClearSorting
	DataChanged
	GetGridSize
	GetTitleLevel

Derived from TCustomDBGrid

	Create
	DefaultDrawColumnCell
	DefaultDrawDataCell
	DefaultHandler
	Destroy
	ExecuteAction
	ShowPopupEditor
	UpdateAction
	ValidFieldIndex

Derived from TCustomGrid

	MouseCoord

Derived from TWinControl

	Broadcast
	CanFocus
	ContainsControl
	ControlAtPos
	CreateParented
	CreateParentedControl
	DisableAlign
	DockDrop
	EnableAlign
	FindChildControl
	FlipChildren
	Focused
	GetTabOrderList
	HandleAllocated
	HandleNeeded
	InsertControl
	Invalidate
	PaintTo
	Realign
	RemoveControl
	Repaint
	ScaleBy
	ScrollBy
	SetBounds
	SetFocus
	Update
	UpdateControlState

Derived from TControl

	BeginDrag
	BringToFront
	ClientToParent
	ClientToScreen
	Dock
	DragDrop
	Dragging
	DrawTextBiDiModeFlags
	DrawTextBiDiModeFlagsReadingOnly
	EndDrag
	GetControlsAlignment
	GetParentComponent
	GetTextBuf
	GetTextLen
	HasParent
	Hide
	InitiateAction
	IsRightToLeft
	ManualDock
	ManualFloat
	MouseWheelHandler
	ParentToClient
	Perform
	Refresh
	ReplaceDockedControl
	ScreenToClient
	SendToBack
	SetTextBuf
	Show
	UseRightToLeftAlignment
	UseRightToLeftReading
	UseRightToLeftScrollBar

Derived from TComponent

	BeforeDestruction
	DestroyComponents
	Destroying
	FindComponent
	FreeNotification
	FreeOnRelease
	GetNamePath
	InsertComponent
	IsImplementorOf
	ReferenceInterface
	RemoveComponent
	RemoveFreeNotification
	SafeCallException
	SetSubComponent

Derived from TPersistent

	Assign

Derived from TObject

	AfterConstruction
	ClassInfo
	ClassName
	ClassNameIs
	ClassParent
	ClassType
	CleanupInstance
	Dispatch
	FieldAddress
	Free
	FreeInstance
	GetInterface
	GetInterfaceEntry
	GetInterfaceTable
	InheritsFrom
	InitInstance
	InstanceSize
	MethodAddress
	MethodName
	NewInstance


TCRDBGrid events

TCRDBGrid	Legend

In TCRDBGrid

	OnGetCellParams
	OnMemoClick

Derived from TCustomDBGrid

	OnCellClick
	OnColEnter
	OnColExit
	OnColumnMoved
	OnDrawColumnCell
	OnDrawDataCell
	OnEditButtonClick
	OnTitleClick

Derived from TWinControl

	OnEnter
	OnExit
	OnKeyDown
	OnKeyPress
	OnKeyUp

Derived from TControl

	OnDblClick
	OnDragDrop
	OnDragOver
	OnEndDock
	OnEndDrag
	OnStartDock
	OnStartDrag


TCRColumn properties

TCRColumn	Legend

In TCRColumn

FilterExpression

FloatDigits

FloatFormat

FloatPrecision

SortOrder

SortSequence

SummaryMode

TotalString

TotalValue

Derived from TColumn

Alignment

AssignedValues

ButtonStyle

Color

DisplayName

DropDownRows

Expandable

Expanded

Field

FieldName

Font

Grid

ImeMode

ImeName

ParentColumn

PickList

PopupMenu

ReadOnly

Showing

Title

Visible

Width

Derived from TCollectionItem

Collection

ID

Index