Unit rDBGrid

Description

rDBGrid is enhanced DBGrid component which provides many new functions (show checkboxes, graphics and memo fields, build-in editors, pictures in title row or in data cells, multiple line titles and rows, sorting functions, fiter buttons, grouping fields etc).

Updated version compatible with Delphi2010+ and 64bit platform. Splash screen in demo version.

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TOptionsFixedCell setting for rDBGrid fixed cells, part of TOptionEx2
Class TOptionsEditors setting for rDBGrid editors, part of TOptionEx2
Class TOptionsAppearance setting for rDBGrid appearance, part of TOptionEx2
Class TOptionsFilters setting for rDBGrid filters, part of TOptionEx2
Class TOptionsGroups setting for rDBGrid groups, part of TOptionEx2
Class TOptionsCellCondition setting for rDBGrid cell condition, part of TOptionEx2
Class TOptionsEx2 setting for rDBGrid new functions, replacement of previous TOptionsEx
Record TColumnStoredProp record definition for storing of default column width and actual filter
Record TDataImageDef data image record used by rDBGrid
Record TSummaryResults define record for calculated summary
Class TrDBGridInplaceEditEx define inplace editor
Class TTitleLineText define object for setting of text in title of grid
Class TFixedColText define object for setting of text in fixed column
Class TFooterRow define object for setting of text in fixed column
Class TCellParamsCond define object for storing of one condition for cell highlighting
Class TCellParamsCondList define list of conditions for cell highlighting
Record TGroupInfo define record for grouped field
Class TrDBGrid enhanced DBGrid component which provides many new functions (show checkboxes, glyph for graphics and memo fields, build-in editors, pictures in title row or in data cells, multiple line titles, sorting functions etc)
Class TrDBGridCustomSorter define base Sorter component for dataset sorting; must be used as based class for any other dataset sorter

Functions and Procedures

procedure ResortAllGrids(F: TForm; ToFirst: boolean); overload;

Types

TOptionEx = (...);
TOptionsBlobType = (...);
TOptionTextFilterType = (...);
TOptionsEx = set of TOptionEx;
TLookupCondition = (...);
TColumnWidth = (...);
TColumnStoredProps = array of TColumnStoredProp;
TSortFieldNames = array of string;
TSortDirections = array of boolean;
TChangeSortEvent = procedure(Sender: TObject; DataSet: TDataSet; SortFieldName: string; SortDesc: boolean; var Accept: boolean) of object;
TChangeSortEventEx = procedure(Sender: TObject; DataSet: TDataSet; SortFieldNames: TSortFieldNames; SortDirections: TSortDirections; var Accept: boolean) of object;
TLoadPickListEvent = procedure(Sender: TObject; DS: TDataSet; FieldName: string; PickList: TStrings) of object;
TFunnelFilterAddToList = procedure(DisplayText, ValueText: string; Checked: boolean) of object;
TLoadFunnelFilterEvent = procedure(Sender: TObject; DS: TDataSet; FieldName: string; AddToListProc: TFunnelFilterAddToList; var IsLoaded: boolean) of object;
TGetHintStringEventEx = procedure(Sender: TObject; UnderMouseColumn: TColumn; TitleRow, FooterRow: boolean; FieldValues: TStrings; CellText: string; var HintString: string) of object;
TDrawTitleLineEvent = procedure(Sender: TObject; const Rect: TRect; var Text: string) of object;
TGetFixedColStateEvent = procedure(Sender: TObject; ActiveRow: boolean; AFont: TFont; var Text: string; var CheckBoxChecked: boolean) of object;
TGetFixedRowStateEvent = procedure(Sender: TObject; DataCol: integer; Column: TColumn; AFont: TFont; var Text: string; var RotateText: boolean) of object;
TGetCellParamsEvent = procedure(Sender: TObject; Field: TField; AFont: TFont; var Background: TColor; ActiveRow, Highlight: boolean) of object;
TGetCellParamsEventEx = procedure(Sender: TObject; Field: TField; AFont: TFont; var Background: TColor; var DataImageDef: TDataImageDef; ActiveRow, Highlight: boolean) of object;
TRecalculateSummaryResultEvent = procedure(Sender: TObject; F: TField; var SummaryResults: TSummaryResults) of object;
TGetSummaryResultEvent = procedure(Sender: TObject; F: TField; SummaryResults: TSummaryResults; TagStr: string; ForFooter: boolean; var DisplayText: string) of object;
TDrawFooterRowEvent = procedure(Sender: TObject; FooterRect: TRect; var FooterSimpleText: string; var DefaultDrawing: boolean) of object;
TDrawFooterCellEvent = procedure(Sender: TObject; FooterCellRect: TRect; ColIndex: integer; Field: TField; var FooterCellText: string; var DefaultDrawing: boolean) of object;
TFooterCellClick = procedure(Sender: TObject; ACol: integer; Column: TColumn) of object;
TSetColumnFilterEvent = procedure(Sender: TObject; DataSet: TDataSet; Field: TField; FilterString, FilterValue: string; FilterForm: TForm; var Result: boolean) of object;
TScanDatasetEvent = procedure(Sender: TObject; DataSet: TDataSet; Reason: integer) of object;
TColWidthChangedEvent = procedure(Sender: TObject; Column: TColumn; ManualSizing: boolean) of object;
TGetEllipsisButtonFormat = procedure(Sender: TObject; ColIndex: Longint; Field: TField; var ButtonWidth: integer; var Glyph: TBitmap) of object;
TCanEditEvent = procedure(Sender: TObject; Field: TField; Column: TColumn; var CanEdit: boolean) of object;
TCellParamsCondOperators = (...);
TCellParamsCondActions = (...);

Constants

GroupHeaderSep = '::';
FieldListSep = ';';
DataImagesFieldCfg = 'Cfg_Align';
grrColumnWidth = 1;
grrSummaryCalc = 2;
grrQuickLookup = 3;
grrLoadPickList = 4;
grrCopyData = 5;
grrLoadFilterList = 6;
cSummaryTag_Prefix = '%';
cSummaryTag_Sum = 'SUM';
cSummaryTag_Min = 'MIN';
cSummaryTag_Max = 'MAX';
cSummaryTag_AVG = 'AVG';
cSummaryTag_CountVal = 'COUNTVAL';
cSummaryTag_CountNull = 'COUNTNULL';
cSummaryTag_CountAll = 'COUNTALL';
cSummaryTag_SelSum = 'SELSUM';
cSummaryTag_SelMin = 'SELMIN';
cSummaryTag_SelMax = 'SELMAX';
cSummaryTag_SelAVG = 'SELAVG';
cSummaryTag_SelCountVal = 'SELCOUNTVAL';
cSummaryTag_SelCountNull = 'SELCOUNTNULL';
cSummaryTag_SelCountAll = 'SELCOUNTALL';

Description

Functions and Procedures

procedure ResortAllGrids(F: TForm; ToFirst: boolean); overload;

find all rDBGrids on the form and call Resort procedure for each of them

Types

TOptionEx = (...);

list of OptionEx properties, deprecated, use TOptionEx2 instead

Values
  • dgTitleExBtn
  • dgTitleBtn
  • dgFixColBtn
  • dgBool
  • dgMemo
  • dgMemoShowText
  • dgGraphic
  • dgGraphicShowImg
  • dgDateTimePicker
  • dgDrawRowFocus
  • dgDrawColoredRow
  • dgOneClickCheckbox
  • dgAutoSaveCheckBox
  • dgHideHScrollBar
  • dgNotProcDblClick
  • dgNotProcMemoDblClick
  • dgNotProcGraphicDblClick
  • dgOnlyPickListValues
  • dgAllowReadOnlyButton
  • dgNotHighlightMultiselect
  • dgStandardTabKey
  • dgDragCell
  • dgUseTitlePopup
  • dgAutoPickListWidth
  • dgUseCellParamsConditions
  • dgFilterButtons
  • dgMultiFieldFilter
  • dgFieldGroups
  • dgAlwaysUseFieldGroupColors
  • dgAllowPasteMultipleCells
  • dgRotateTitleText
  • dgBlockInsertByKey
TOptionsBlobType = (...);

blob content appearance type for rDBGrid - standard, glyph or content

Values
  • obtNone
  • obtGlyph
  • obtContent
TOptionTextFilterType = (...);

text filter type for rDBGrid filter bar

Values
  • oftAnyPos
  • oftStartPos
  • oftExactValue
TOptionsEx = set of TOptionEx;

set of OptionEx properties

TLookupCondition = (...);

list of possible AutoLookup conditions

Values
  • lcNever
  • lcBrowse
  • lcNotEdit
TColumnWidth = (...);

list of possible column width types

Values
  • cwNone
  • cwDefaultWidth
  • cwSameWidth
  • cwAutoWidth
  • cwDataWidth
  • cwLabelWidth
  • cwDataLabelWidth
  • cwHideEmptyCol
TColumnStoredProps = array of TColumnStoredProp;

array type for storing of TColumnStoredProp for all columns

TSortFieldNames = array of string;

array of field names used for sorting

TSortDirections = array of boolean;

array of directions used for sorting

TChangeSortEvent = procedure(Sender: TObject; DataSet: TDataSet; SortFieldName: string; SortDesc: boolean; var Accept: boolean) of object;

event is called after click on title row to provide sorting if Sorter component is not used; if "Accept" remains true, "SortFieldName" and "SortDesc" is changed and sort marker is shown, in other case nothing is changed; obsolete, use ChangeSortEventEx for multifield sorting

TChangeSortEventEx = procedure(Sender: TObject; DataSet: TDataSet; SortFieldNames: TSortFieldNames; SortDirections: TSortDirections; var Accept: boolean) of object;

Enhanced event with MultiField sorting supprt; event is called after click on title row to provide sorting if Sorter component is not used; if "Accept" remains true, "SortFieldName" and "SortDirections" is changed and sort marker is shown, in other case nothing is changed

TLoadPickListEvent = procedure(Sender: TObject; DS: TDataSet; FieldName: string; PickList: TStrings) of object;

event is called to load picklist or textbar-filter list for particular field - usually by aggregated query

TFunnelFilterAddToList = procedure(DisplayText, ValueText: string; Checked: boolean) of object;

callback procedure used by TLoadFunnelFilterEvent

TLoadFunnelFilterEvent = procedure(Sender: TObject; DS: TDataSet; FieldName: string; AddToListProc: TFunnelFilterAddToList; var IsLoaded: boolean) of object;

event is called to load funnel-filter list for particular field - usually by aggregated query

TGetHintStringEventEx = procedure(Sender: TObject; UnderMouseColumn: TColumn; TitleRow, FooterRow: boolean; FieldValues: TStrings; CellText: string; var HintString: string) of object;

event is called before showing of hint window to get user defined hint string HintFieldValue contain value of field defined by HintFieldName from record under mouse

TDrawTitleLineEvent = procedure(Sender: TObject; const Rect: TRect; var Text: string) of object;

event is called to get title line text or draw title line directly

TGetFixedColStateEvent = procedure(Sender: TObject; ActiveRow: boolean; AFont: TFont; var Text: string; var CheckBoxChecked: boolean) of object;

event is called to get font and text of fixed column cell

TGetFixedRowStateEvent = procedure(Sender: TObject; DataCol: integer; Column: TColumn; AFont: TFont; var Text: string; var RotateText: boolean) of object;

event is called to get font and text of fixed row cell (title cell)

TGetCellParamsEvent = procedure(Sender: TObject; Field: TField; AFont: TFont; var Background: TColor; ActiveRow, Highlight: boolean) of object;

event is called to get params of data cell

TGetCellParamsEventEx = procedure(Sender: TObject; Field: TField; AFont: TFont; var Background: TColor; var DataImageDef: TDataImageDef; ActiveRow, Highlight: boolean) of object;

event is called to get extended params of data cell

TRecalculateSummaryResultEvent = procedure(Sender: TObject; F: TField; var SummaryResults: TSummaryResults) of object;

event is called to set all calculated values for one column (field), usually by some SQL query instead of record scan

TGetSummaryResultEvent = procedure(Sender: TObject; F: TField; SummaryResults: TSummaryResults; TagStr: string; ForFooter: boolean; var DisplayText: string) of object;

event is called to update or format one particular calculated value of field (sum, min, max, avg ...)

TDrawFooterRowEvent = procedure(Sender: TObject; FooterRect: TRect; var FooterSimpleText: string; var DefaultDrawing: boolean) of object;

event is called to get footer simpletext or draw footer rect directly

TDrawFooterCellEvent = procedure(Sender: TObject; FooterCellRect: TRect; ColIndex: integer; Field: TField; var FooterCellText: string; var DefaultDrawing: boolean) of object;

event is called to get footer cell text or draw footer cell directly

TFooterCellClick = procedure(Sender: TObject; ACol: integer; Column: TColumn) of object;

event is called after click to footer cell

TSetColumnFilterEvent = procedure(Sender: TObject; DataSet: TDataSet; Field: TField; FilterString, FilterValue: string; FilterForm: TForm; var Result: boolean) of object;

event is called after setting filter for any column

TScanDatasetEvent = procedure(Sender: TObject; DataSet: TDataSet; Reason: integer) of object;

event is called before and after dataset scan

TColWidthChangedEvent = procedure(Sender: TObject; Column: TColumn; ManualSizing: boolean) of object;

event is called after changing of column width

TGetEllipsisButtonFormat = procedure(Sender: TObject; ColIndex: Longint; Field: TField; var ButtonWidth: integer; var Glyph: TBitmap) of object;

event is called to define format of Ellipsis button in the cell

TCanEditEvent = procedure(Sender: TObject; Field: TField; Column: TColumn; var CanEdit: boolean) of object;

event is called before editing of cell, CanEdit define possibility to editation

TCellParamsCondOperators = (...);

list of operators for cell highlighting conditions

Values
  • cpoEqual
  • cpoLess
  • cpoLessOrEq
  • cpoGreater
  • cpoGreaterOrEq
  • cpoNotEqual
  • cpoStart
  • cpoNotStart
  • cpoContain
  • cpoNotContain
  • cpoAllways
TCellParamsCondActions = (...);

list of logical operators for cell highlighting conditions

Values
  • cpaSet
  • cpaAND
  • cpaOR

Constants

GroupHeaderSep = '::';
 
FieldListSep = ';';
 
DataImagesFieldCfg = 'Cfg_Align';
 
grrColumnWidth = 1;

constants used by BeforeScanDataset and AfterScanDataset events to indicate reason of dataset scan

grrSummaryCalc = 2;
 
grrQuickLookup = 3;
 
grrLoadPickList = 4;
 
grrCopyData = 5;
 
grrLoadFilterList = 6;
 
cSummaryTag_Prefix = '%';

constans used as TAG for summary text in title content popup and for footer row

cSummaryTag_Sum = 'SUM';
 
cSummaryTag_Min = 'MIN';
 
cSummaryTag_Max = 'MAX';
 
cSummaryTag_AVG = 'AVG';
 
cSummaryTag_CountVal = 'COUNTVAL';
 
cSummaryTag_CountNull = 'COUNTNULL';
 
cSummaryTag_CountAll = 'COUNTALL';
 
cSummaryTag_SelSum = 'SELSUM';
 
cSummaryTag_SelMin = 'SELMIN';
 
cSummaryTag_SelMax = 'SELMAX';
 
cSummaryTag_SelAVG = 'SELAVG';
 
cSummaryTag_SelCountVal = 'SELCOUNTVAL';
 
cSummaryTag_SelCountNull = 'SELCOUNTNULL';
 
cSummaryTag_SelCountAll = 'SELCOUNTALL';
 

Author

Created

Oct 2006

Last Modified

Sep 2018


Generated by PasDoc 0.15.0.