Unit rDBGrid

Description

rDBGrid unit contain TrDBGrid - enhanced TDBGrid 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).

Splash screen in demo version.

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TOptionsFixedCell setting for TrDBGrid fixed cells, part of TOptionsEx2
Class TOptionsEditors setting for TrDBGrid editors, part of TOptionsEx2
Class TOptionsAppearance setting for TrDBGrid appearance, part of TOptionsEx2
Class TOptionsFilters setting for TrDBGrid filters, part of TOptionsEx2
Class TOptionsGroups setting for TrDBGrid groups, part of TOptionsEx2
Class TOptionsCellCondition setting for TrDBGrid cell condition, part of TOptionsEx2
Class TOptionsHighlightText setting for TrDBGrid text highlighting, part of TOptionsEx2
Class TOptionsEx2 setting for TrDBGrid new functions, replacement of previous TOptionsEx
Record TGroupInfo define record for grouped field used by TrDBGrid
Record TColumnStoredProp record definition for storing of default column width and actual filter
Record TDataImageDef data image record used by rDBGrid
Record TDistinctValues define record for distinct values for TSummaryResults
Record TSummaryResults define record for calculated summary
Record TGeneralEventRec general event record used as parameter for TGeneralEvent
Class TrDBGridInplaceEditEx define inplace editor used by TrDBGrid
Class TTitleLineText define object for setting of text in the top of title row used by TrDBGrid
Class TFixedColText define object for setting of text in fixed column for TrDBGrid
Class TFooterRow define object for setting of summary footer row used by TrDBGrid
Class TCellParamsCond define object for storing of one condition for cell highlighting used by TrDBGrid
Class TCellParamsCondList define list of conditions for cell highlighting used by TrDBGrid
Class TrComboBoxExFilter special extension of TrComboBoxEx for using in filter bar
Class TrDBGrid enhanced TDBGrid 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;
function GetFldListrDBGrid(rDBGrid: TrDBGrid; List: TStrings; FldsDef: TGetFldDefs): integer;

Types

TOptionsBlobType = (...);
TOptionTextFilterType = (...);
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;
TGeneralEventType = (...);
TGeneralEvent = procedure(Sender: TObject; EventType: TGeneralEventType; var EventParam: TGeneralEventRec; var ContinueEvent: boolean) of object;
TCellParamsCondOperators = (...);
TCellParamsCondActions = (...);

Constants

GroupHeaderSep = '::';
FieldListSep = ';';
DataImagesFieldCfg = 'Cfg_Align';
FilterPanelFieldHint = '#FilterPanel#';
MergedCellSuffix = '_MergedCell';
ButtonSuffix = '_Button%d';
SpecialLineSep = '|';
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';
cSummaryTag_DistinctValues = 'DISTINCTVALUES';
cSummaryTag_RecNo = 'RECNO';
cSummary_DistinctValuesMax = 25;

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

function GetFldListrDBGrid(rDBGrid: TrDBGrid; List: TStrings; FldsDef: TGetFldDefs): integer;

returns list of field for rDBGrid according to FldsDef

Types

TOptionsBlobType = (...);

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

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

text filter type for TrDBGrid filter bar

Values
  • oftAnyPos
  • oftStartPos
  • oftExactValue
  • oftAnyPosForNoLikeChar
TLookupCondition = (...);

list of possible AutoLookup conditions

Values
  • lcNever
  • lcBrowse
  • lcNotEdit
  • lcBrowseFilter
  • lcNotEditFilter
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 support; 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 including TDataImageDef for showing of images with additional text

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, set CanEdit = false to block editing of the cell

TGeneralEventType = (...);

general event type used for TGeneralEvent

Values
  • geChangeScaleBefore
  • geChangeScaleAfter
  • geIsBool
  • geIsMemo
  • geIsMemoGlyph
  • geIsMemoText
  • geIsHTMLText
  • geIsRichEdit
  • geIsGraphic
  • geIsFieldAsDate
  • geIsDate
  • geIsFieldAsTime
  • geIsTime
  • geIsColor
  • geIsLink
  • geIsPassword
  • geIsFilter
  • geIsDrawDropDown
  • geIsDataBar
  • geIsStatusBar
  • geIsDataImage
  • geIsFixedColumn
  • geIsReadOnlyColumn
  • geIsLookupFilterColumn
  • geGetTitleImageIndex
  • geGetTitleButtonList
  • geShowMemoDialog
  • geShowGraphicDialog
  • geSetColumnWidth
  • geContextPopup
  • geContextTitlePopup
  • geContextTitleExPopup
  • geContextTitleMergedCellPopup
  • geContextFixColPopup
  • geGetDataBarParam
  • geGetStatusBarParam
  • geGetFooterRowParam
  • geGetDataImageIndex
  • geGetDataImageAlignment
  • geDropDownShowing
  • geDropDownClosed
TGeneralEvent = procedure(Sender: TObject; EventType: TGeneralEventType; var EventParam: TGeneralEventRec; var ContinueEvent: boolean) of object;

event is called in many events to add posibility of any custom setting or code and to skip rest of the standard event

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';
 
FilterPanelFieldHint = '#FilterPanel#';
 
MergedCellSuffix = '_MergedCell';
 
ButtonSuffix = '_Button%d';
 
SpecialLineSep = '|';
 
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';
 
cSummaryTag_DistinctValues = 'DISTINCTVALUES';
 
cSummaryTag_RecNo = 'RECNO';
 
cSummary_DistinctValuesMax = 25;
 

Author

Created

Oct 2006

Last Modified

Dec 2021


Generated by PasDoc 0.15.0.