Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Developers guide
EhLib Team
Edition: 2.00
(Changes compared to
revision 1.62 is highlighted in
red)
Contents
Introduction ............................................................................................................... 5
Installation ............................................................................................................... 10
Unpacking archive......................................................................................................................10
Installing packages. ....................................................................................................................10
Installing help files. ....................................................................................................................12
Components for planning and visual interactive event management ................... 134
Components for uploading DataSet to a text file and load a text file ................... 137
Hiding a component form in Design-Time ........................................................... 140
Feedbacks and bug reports .................................................................................... 141
Introduction
The Library contains components and classes for Borland Delphi and Borland C++ Builder. The
Library is intended to write professional interactive applications that work with the database:
rendering, printing and entering data by the end user.
TDBGridEh component
Using TDBGridEh
It provides all functionality of TDBGrid and adds several new features as follows:
- Allows to select records, columns and rectangle areas.
- Provides special titles that can cover several or all columns.
- Can have a footer that is able to show sum/count/other field values.
- Allows to resize column automatically to fit grid width equal to client width.
- Has an ability to change row height and title height.
- Allows automatic broken of a single line long title and data rows to a multiline.
- Allows title to act as button and, optionally show a sort marker.
- Allows to mark titles by sortmarking sings automatically and sort data in DataSet.
- Allows to truncate long text with ellipsis in cells.
- Allows lookup list to show several fields.
- Have an ability to make an incremental search in lookup fields.
- Can have frozen nonscrollable columns.
- Allows to show DateTime picker for TDateField and TDateTimeField.
- Allows to show bitmaps from TImageList depending on field value.
- Allows to hide and track horizontal or vertical scrollbars.
- Allows to hide columns.
- Allows to show 3D frame for frozen, footer and data rows.
- Allows to draw memo fields.
- Can show multiline inplace editor.
- Can have a proportional scrolling for DadaSets independently of datasets sequencing.
- Allows to show checkboxes automatically for Boolean fields. Allows to show checkboxes
for other type of fields.
- Has procedures to save and restore layout (visible columns, columns order, columns
width, sortmarkers, row height) in/from registry or ini file.
- Allows to show hint (ToolTips) for text that don't fit in the cell.
- Allows to export data to Text, Csv, HTML, RTF, XLS and internal formats.
- Allows to import data from Text and internal formats.
- Can sort data in various datasets.
- Can filter data in various datasets.
TDBVertGridEh
Using TDBVertGridEh
TDBVertGridEh Component is a Vertical Grid. The component is used to display and edit a single
record DataSet in a vertical orientation. The data is displayed in two columns. The first column
displays the names of the fields in the second field values of the current record.
The component supports the following features:
- Allows you to display Memo field of graphics and pictures Blob fields.
- Allows you to wrap long lines and increase the height of each cell to display all the
contents of the cell.
- Allows the user to customize the mapping of cell data.
- Has the event to dynamically change the font, color and other parameters of the cell,
depending on the values of the fields of the current record.
- Allows you to display special tips Tooltips for text that does not fit into the cell.
- Allows you to have a dynamic line - created according to the dataset fields, and static created and customized in advance DesignTime. It works the same in columns Columns
TDBGridEh.
See a detailed description of the component in the section Using TDBVertGridEh
TDBLookupComboboxEh component
Using edit controls
It provides all functionality of TDBLookupCombobox and adds several new features as follows:
- Can have flat style.
- Allows to assign values as to KeyValue property and as to display Text property.
- Allows to hold KeyValue and Text that will not affect to each others values.
Drop down list can:
- Show titles,
- Have sizing grip,
- Automatically set width as sum of DisplayWidth of the list fields (Width = -1),
- Automatically drops when the user pressed the key.
- Can have specified width.
Edit button can:
- Show DropDown and Ellipsis or Bitmap image.
Have additional events: OnKeyValueChanged and OnButtonClick.
TDBSumList component
Using TDBSumList
It is intended for calculating sums and amount of records in a TDataSet with dynamic changes.
Component keeps a list of TDBSum objects, which contains types of group operations (goSum
or goCount) and name of fields which values need some calculation. (goCount name of field is
unnecessary).
TPrintDBGridEh component
Using TPrintDBGridEh
TPrintDBGridEh provides properties and routines for preview and print of TDBGridEh
component with several features:
- Ability to expand rows vertically until all text is printed.
- Ability to scale grid to fit it to the page width.
- Ability to print/preview title for grid.
- Ability to print/preview page header and page footer where you can specify macros for
current page, current date, current time and/or static text.
- Automatically print/preview multi-selected area of TDBGridEh if its area is not empty.
- Ability to print/preview rich text before and after grid.
TPreviewBox component
TPreviewBox lets you to create a customizable runtime preview.
TPrinterPreview object
TPrinterPreview lets you to record printable data in buffer for following output them on screen
and to printer. TPrinterPreview have all functions and properties as in TPrinter object. You can
use TPrinterPreview object similarly to TPrinter except some details. In TPrinter
Printer.Canvas.Handle and Printer.Handle is the same but in TPrinterPreview
TDBMemoEh
The component is designed for editing multi-line text data.
The component can operate in Data-Aware mode (connected to DataSet), and can work as non
data-aware edit control.
TDBImageEh
The component is designed for editing a graphic data.
The component can operate in Data-Aware mode (connected to DataSet), and can work as non
data-aware edit control.
TDBRadioGroupEh
The component is a set of selection flags (radiobuttons).
The component can operate in Data-Aware mode (connected to DataSet), and can work as non
data-aware edit control.
TDBRichEditEh
The component is designed for editing multi-line text data with the ability to format it as
RichText.
The component can operate in Data-Aware mode (connected to DataSet), and can work as non
data-aware edit control.
the correct operation of additional server operations, such as getting the value of the
incremental table fields after inserting record, etc.
TIBXConnectionProviderEh component
Provides the interface between the component TIBXDataDriver and TIBDatabase in DesignTime and Run-Time. Contains built TIBDatabase component.
TBDEConnectionProviderEh component
Provides the interface between the component TBDEDataDriver and TDatabase in Design-Time
and Run-Time. Contains built TDatabase component. Specifies the type of server data for the
correct operation of additional server operations, such as getting the value of the incremental
table fields after inserting record, etc.
TPivotDataSourceEh
Downloads and store pivot data.
TPivotGridEh
Component-control to display pivot data.
TPivotGridToolBoxEh
Component-control for configuration data structure and sections stored in the PivotDataSource
component.
TPlannerDataSourceEh
The component is used to store event objects such as TPlannerDataItemEh.
TPlannerControlEh
The visual component-container TPlannerControlEh contains a set of visual components
PlannerView.
TPlannerCalendarPickerEh
The visual component-calendar is designed to navigate through the days of the month.
Installation
Below it will be described how to install EhLib under Delphi XE5.
Unpacking archive
Unpack EhLib archive.
After unpacking you will have next list of directories:
Directories of the library archive:
Installer
Common
Delphi7
Delphi9.Vcl
Delphi2007
BDS2006.Vcl
RADStudio2009
RADStudioXXXX
Demos
Demos\Bin
Demos\Data
LangResources
DataDrivers
DataService
Orders
HLP
Contain source files which are common for all versions of Delphi and C++
Builder.
Contain source files which are specific for Delphi 7.
Contain source files which are specific for Delphi 9.
Contain source files which are specific for Delphi 2007.
Contain source files which are specific for Developer Studio 2006.
Contain source files which are specific for RAD Studio 2009.
Contain source files which are specific for RAD Studio XXXX.
Demonstration projects
Contains the compiled executables major demonstration projects.
(Contains files only in the editorial - EhLib Evaluation)
Contains the database files for the demonstration projects.
Contain resource files for various languages.
Contains additional components that inherit from TDataDriverEh
generators to support data access third party.
Contain files that contain objects that allows to sort data in various types of
datasets.
Contain text files in which described how to register various versions of
EhLib.
Contain help files.
Installing packages.
Automatic installing:
Run Installer\EhLibInstaller.exe program from EhLib archive to install library in Delphi/C++
Builder IDE automatically. In time of installation the program creates folder, copies files,
compile required packages and registers packages in the IDE.
Manual installing:
Here is described how to install the library in RAD Studio XE5. Installation in other versions of
Delphi is performed by analogy.
Create, if necessary, a new folder "EhLib" folder with a Delphi (for example, C:\ RADStudio\12.0
\Components\EhLib).
If you EhLib version with source code then copy to this folder files from Common and
RADStudioXE5 of archive EhLib.
If you have a version of EhLib without source or evaluation-version, then copy the files to this
folder from the folder <EhLib Archive>\RADStudioXE5\Win32\Release. The library without
source code in the folder <EhLib Archive> \Common Files with the extension are Int. These files
contain the original interface of the pas file libraries. These files are conveniently used as
documentation.
By default EhLib contains resource files for the English language. If you need a different
language, you can replace the original resource files (which are already in the
C:\RADStudio\12.0\Components\EhLib) files that are in the appropriate subfolder
LangResources and change them if necessary.
Uninstall previous or evaluation version of EhLib Delphi IDE.
Remove or move to another folder, the following files to prevent this crossing and the new
version EhLib. Delete all files that start with EhLib ___. Bpl, DclEhLib ____. Bpl, EhLib ___. Bpi,
DclEhLib ____. Pbi folder "C: \ Users \ Public \ Documents \ RAD Studio \ 12.0 \ Bpl \", "C: \
Users \ Public \ Documents \ RAD Studio \ 12.0 \ Dcp \ "and" C: \ Users \ Public \ Documents \
RAD Studio \ 12.0 \ Dcp \ ".
Start Delphi and open ("File \ Open ...") project group EhLibProjGroup190.groupproj.
Compile all group packages ("Project \ Build All Projects").
Install all the packages in the IDE, which begin on Dcl______. To do this, use the mouse to
select the package of "Install".
Components EhLib appear in the pages of 'EhLib Controls' and' 'EhLib Components' component
palette.
Troubleshooting.
Problem:
In compilation time
Delphi shows next error:
"Unit AAA compiled with
different version of unit
BBB"
[Fatal Error]
EhLib.dpk(51): File not
found: 'DBSumLst.dcu'
Solution:
1. It can be because Delphi have access to units from old version of
EhLib. Try to remove old version of EhLib completely.
2. It can be because your Delphi or C++ Builder Build number is not
equal to Delphi or C++ Builder Build number under which EhLib was
compiled. See Build number of Delphi and C++ Builder under which
EhLib was compiled below:
It can be, because you did not copy files from Common and Delphi6
directories of EhLib archive to the one directory.
If you have EhLib - source include version then copy files from
Common and Delphi6 directory of EhLib archive to alone directory.
Support Library LCL (Lazarus, Free Pascal) Installation packages for Lazarus.
EhLib is compatible with LCL framework (Lazarus, Free Pascal) for the Win32 platform.
Detail information about support and installation packages for Lazarus read in the file <EhLib
archive> /Lazarus/readme.txt
Form as grid, then icon of DataSource will be shown in the bottom right corner of the Grid. You
can click on the DataSource icon to select DataSource in Object Inspector. In same manner grid
can show DataSet. If a DataSet is a TMemTableEh then grid also can show TDataDriver and
DataSet which is connected to DataDriver as a ProviderDataSet.
You can use the following properties and methods for accessing the grid columns:
property DBGridEh.Columns: TDBGridColumnsEh
The main collection of columns
property DBGridEh.VisibleColumns: TColumnsEhList
List of visible columns. The list is automatically updated when you change the
basic list or change the columns visible columns
property DBGridEh.FieldColumns[const FieldName: String]:
TColumnEh
Search a column by name field. If the column, which TColumnEh.FieldName =
FieldName is not found, an exception is thrown.
function FindFieldColumn(const FieldName: String): TColumnEh;
Search column name field. If the column, which TColumnEh.FieldName =
FieldName is not found then it returns nil.
property SortMarkedColumns: TColumnsEhList
List
of
columns wher
sorting
markers
TColumnEh.Title.SortMarker property.
are
set
with
the
The column data type Combobox Editor is a column in which the data
is opened for editing text editor with the ability to select data from the
drop-down list. In the right part of column the editor shows the special
button DropDownEditButton. When clicked, it displays a drop-down
list.
When the grid has a column of Combobox type it is convenient have
edit buttons be always displayed in the column of the grid, but not only
within the text editor in the cell.
To customize the display of buttons, use the following properties:
- TDBGridEh.ColumnDefValues.AlwaysShowEditButton
- TColumnEh.AlwaysShowEditButton
- TDBGridEh.EditButtonsShowOptions
For more details on the edit button, see Working with edit buttons.
Using the properties of the column and the type of field you can configure Column for four
main types Comboboxes:
: PickList Combobox - For this combobox the data for a drop-down list are taken from the
TColumnEh.PickList property. To activate this type combobox just fill TColumnEh.PickList
property by list of possible values. In this mode the drop-down list can contain only one
column, can not display headers or special row SpecRow.
: DataList Combobox - For this type of combobox the data for a drop-down list are taken from a
DataSet specified by TColumnEh.DropDownBox.ListSource property. To activate this type of
combobox assign TColumnEh.DropDownBox.ListSource property by a DataSource which
indicate a DataSet with a list of values.
: KeyPickList Combobox - This mode uses two lists - KeyList and PickList. KeyList contains values
that are stored in the field specified by TColumnEh.FieldName ptoperty, and PickList - in the
relevant index contains the value to be displayed in the column and list. You can also set a
Column.NotInKeyListIndex property by the index from PickList property, which is displayed if
the value of the field is not contained in KeyList (for example, you can specify the index for Nullfield value). You can also set Column.DblClickNextval to True, to allow users to change the value
by double-clicking the mouse.
: LookupCombobox - In this mode, the data for the list are set through a field TField justified as
a lookup field or through the subproperties of TColumn.LookupParams property. See more
details about this mode in the next section "Configuring lookup relationship in columns grid"
Use the following properties of TColumnEh (or TFieldRow for DBVertGridEh) for advanced
configuration and work with LookupCombobox and DataList Combobox:
TColumnEh.CaseInsensitiveTextSearch Specifies that the text search in the drop down
list is case-insensitive.
TColumnEh.LimitTextToListValues limits the ability to enter text only by a text from the
list.
If TColumnEh.LimitTextToListValues = False, then after you enter the text that is not in the list
and attempt to leave the cell, or press Enter the TColumnEh.OnNotInList event is triggered. The
event handler is passed the entered text NewText argument. You can add text to the list. If
the list is based on data from the DataSet, the new value should be added in the DataSet. After
values is added in the DataSet set RecheckInList property to True. For Combobox of
LookupCombobox type the grid re-perform lookup search the list and write the data to the cell.
Configure the lookup relationship in grid columns.
You can also fill TField properties in the Object Inspector as follows:
FieldKind = fkLookup
KeyField = field name that contains the code values in the original DataSet
LookupDataSet = DataSet that contains dictionary values
LookupKeyFields = field name that contains the code values in the dictionary DataSet
LookupResultField = field name in dictionary DataSet whose content should be displayed
instead of the code.
Lookup columns in the grid.
DBGridEh and DBVertGridEh automatically determine then Field.FieldKind is lookup and create
a cell with a dropdown list so that it looks like a LookupComboBox.
In addition, the column (TColumnEh and TFieldRow) contain additional properties for the
empowerment of working with lookup fields.
To display multiple fields in the drop-down list fill the Column.LookupDisplayFields property by
the list of field names separated by a semicolon - ";".
By default, the drop-down list displays a single column with the value specified in the field
TField.LookupResultField. You can customize the list so that it displays multiple fields from the
DataSet specified property TField.LookupDataSet.
Method 1: - Fill TColumnEh.DropDownBox.ListFieldNames property by the list of fields. Several
fields are separated by semicolons - ";".
Method 2: - Fill TColumnEh.DropDownBox.Columns collection with elements. With this
method, you can also customize the font and the other a property of each column drop-down
list.
Configure lookup relationships directly into the grid column.
DBGridEh and DBVertGridEh has the ability to create lookup relationships directly into grid
columns. To do this, use the sub-properties of TColumn.LookupParams property. Fill in the subproperties similar to how it is configured in the TField. In this case, leave TColumn.FieldName
property empty.
The TColumn.LookupParams property has the following subproperties
Property Name
Property Type
Description
KeyFieldNames
String
LookupCache
Boolean
LookupDataSet
TDataSet
LookupDisplayFieldName String
LookupKeyFieldNames
String
With a large number of customized lookup columns in the grid, drawing data may be slow
because Search lookup values occurs in each cell drawing. But drawing can be accelerated, if
you use TMemTableEh as a DataSet. MemTableEh provides the ability to create in DBGridEh
associated buffer values found and dynamically obnovlyaet it as data changes MemTableEh.
Use the following TColumnEh properties (TFieldRow for DBVertGridEh) for advanced
configuration of LookupCombobox and DataList Combobox:
AutoDropDown
Specifies that the drop-down list will be displayed automatically when user starts typing
in the Combobox editor.
DropDownRows
Specifies the height of the drop-down list. The height given in the text lines.
DropDownShowTitles
Specifies whether to display the column headings in the drop-down list. The texts are
taken from the header field names or from the collection of columns specified property
TColumnEh.DropDownBox.Columns.
DropDownSizing
Gets or sets a value specifying whether to display sizing bar in the drop-down list. The
sizing bar is displayed in the lower right part of the window below the vertical scroll bar.
DropDownWidth
Specifies the width of the drop-down list. A value of -1 sets an indication that the width
is calculated automatically based on the width of the specified fields.
DropDownSpecRow
See the section Using
DBLookupComboBoxEh.
SpecRow
columns
and
components
DBGridEh
DropDownBox.AutoFitColWidths
Gets or sets the value indicating the total width of the columns in the drop down list will
always be fited to the width of the client window.
DropDownBox.ColumnDefValues
Defines the value values for the properties for all columns of a drop-down list.
DropDownBox.ListSource
This property can be used for several cases.
1. You can assign the this property by DataSource which refers to special DataSet with a list
of values that is different from the list of the values set in TField.LookupDataSet. For
example, DataSet specified in DBGridEh.DataSrouce.DataSet and DataSet specified in
TColumnEh.DropDownBox.ListSource.DataSet in a relationship Maset-Detail. When you
select a record in DBGridEh, the Maset-Detail attitude fills a list in ListSource.DataSet by
the desired values, which will be displayed when the user clicks the to open drop-down
list in a text editor on the grid for this lookup column.
2. You can adjust the drop-down list to filter data as you type text a cell editor. For detailed
information, see "Filtering Data in lookup dropdown lists when typing"
DropDownBox.ListSourceAutoFilter
See the section "Filtering data lookup dropdown lists when typing"
DropDownBox.ListSourceAutoFilterType
See the section "Filtering data lookup dropdown lists when typing"
DropDownBox.Options
It allows you to set some properties of the drop-down list, such as display dividing lines,
set markers sorting on title click.
DropDownBox.SortLocal
Gets or sets a value indicating that when you click on the title in the drop-down list you
need to sort locally within the DataSet. To customize the sorting and specify the
required values in the property DropDownBox.Options Title.TitleButton and set to True
in the property DropDownBox.AutoFitColWidths.
DropDownBox.UseMultiTitle
Show titles dropdown in MultiTitle mode. Detailed information on the MultiTitle mode
see the section - "Complex headlines."
Grid automatically shows checkboxes for Boolean fields. To show checkboxes for no Boolean
fields, fill first line of Column.KeyList property by value (or values) that corresponds to the
checked state of the checkbox. Fill second line for non-checked state, and set
Column.Checkboxes property to True. One line of KeyList can contain more than one value. In
that case every value must be separated by semicolon.
Drawing of a ProgressBar shaped image in the Grids cell.
Grid doesnt allow customizing column to show ProgressBar shaped image, but there is a
procedure DrawProgressBarEh in the ToolCtrlsEh module. You can use it to
draw image of ProgressBar when an event of custom drawing of a Grids cell is
used.
TDBGridEh allows to show bitmaps from TImageList component depending on the field values.
In order to show bitmaps you need:
1. Fill list Column.KeyList property by the possible field values (every value in the separated
line) and set Column.ImageList property by the TImageList control that has the bitmaps. Every
image in ImageList corresponds to the string line in the KeyList property. You can also set
Column.NotInKeyListIndex property to the index of bitmap that will be shown if the field's value
does not correspond to any value in the KeyList (for instance you can set index of image for Null
field value). At run time you cant edit cells with bitmaps. Use SPACE key or mouse click to set
value from next line of Column.KeyList to the field. Use Shift+SPACE key or Shift+Mouse click to
set value from previous line Column.KeyList. You can also set Column.DblClickNextval to True to
allow changing values in cell by double mouse clicking.
DBGridEh can display images in the data cells in the following formats:
BMP, JPeg,
GIF - From Developer Studio 2007
PNG - From RAD Studio 2009.
To enable the display of graphics data set DBGridEh.DrawGraphicData to True. The grid will display
graphical information for the fields of type TGraphicField and TBlobField who BlobType =
ftGraphic.Default. DBGridEh recognizes only format like TBitmap. For the addition of graphical
modules use the property DBGridEh.IncludeImageModules: TIncludeImageModulesEh;
TIncludeImageModuleEh = (
iimJpegImageModuleEh, - plug-in to display the data in a format JPeg
iimGIFImageModuleEh, - plug-in to display the data in the format of GIF
iimPNGImageModuleEh - plug-in to display the data in PNG
);
This property should only be used in Design-Time compilation via IDE. Setting this property causes the
IDE to add additional modules in the module uses the form.
Demo:
See a Demo project that display image data in the cells of the grid
For TDateField and TDateTimeField fields Inplace Editor will show dropdown button to show
dropdown calendar. Set Column.ButtonStyle to cbsNone to prevent showing the dropdown
button.
The text in a cell as a link
At the time of the call, the grid will be on the required record of DataSet. With a property of
DataSet, you can get the value of all the fields of the record. In the event you can not set
properties of the grid or column.
You can also directly call the DataSet.Post to finish editing the recording immediately after
recording the data in the field.
After changing the width of the column After changing the width of the column is called the
DBGridEh.OnColWidthsChanged event is called.
In the grid it is possible to adjust the width of the columns so that they occupy the entire width
of the visible area of the grid, and did not extend beyond the visible area.
Set TDBGridEh.AutoFitColWidths to True to automatically change the column width so that the
width will be equal to the entire grid visible part of the window. Additional property
TDBGridEh.MinAutoFitWidth specifies the minimum width of the grid at which the change in
width. Use TColumnEh.AutoFitColWidth property of the grid columns at to further determine
whether the column is used for fitting the width of all columns to the width of the visible area.
To allow the mouse to move the columns in the Run-Time, set in the property dghColumnMove
TDBGridEh.OptionsEh. After the column is moved the TDBGridEh.OnColumnMoved event
occurs.
Use the following methods to control the width of columns:
procedure OptimizeColsWidth(ColumnsList: TColumnsEhList; const
CheckRowCount : Integer = -1; const MaxWaitingTime: Integer = 0);
Optimizes the column width so that the entire text of the column could be seen inside
the cell. ColumnsList parameter specifies the list of columns for which it is necessary to
perform optimization. CheckRowCount parameter specifies the number of records that
need to get around to perform optimization. This parameter is set to limit the time of
the method. MaxWaitingTime parameter specifies the maximum period of the method.
Inside a method grid runs through all the records DataSet. If the option is
MaxWaitingTime method adjourned once it reaches the specified value.
procedure OptimizeAllColsWidth(const CheckRowCount : Integer = -1;
const MaxWaitingTime: Integer = 0);
The method works similarly to the previous method, but perform optimization for all the
columns in the grid.
Property Type
Description
DisplayFormat
String
EndEllipsis
Boolean
Layout
TTextLayout
Alignment
TAlignment
WordWrap
Boolean
EditMask
String
TDBGridEh.OnDrawColumnCell
Write OnDrawColumnCell event to overload the standard method of the drawing cell. This
event is called after standard drawing, so the information will be drawn above standard-drawn
contents of cell. You may print the additional data, using methods of
TDBGridEh(Sender).Canvas property.
TDBGridEh.OnDrawDataCell
Do not write an OnDrawDataCell event handler. OnDrawDataCell is obsolete and included for
backward compatibility.
TColumnEh.OnAdvDrawDataCell or
TDBGridEh.OnAdvDrawDataCell
Write this event to draw data in the grid cell. In code of the event we set Processed parameter
in True value to define that the process of drawing was performed in event. Otherwise grid will
call method for default drawing of cell data. You may, if necessary, change such parameters as
ARect or Params. After changing the parameters call Grid.DefaultDrawColumnDataCell method
and set Processed to True value. You can also leave Processed parameter in False state and
dont call Grid.DefaultDrawColumnDataCell. In that case, grid will call default drawing
procedure using changed parameters. Use Grid.Canvas property to draw data in the cell by
yourself.
TDBGridEh.OnGetCellParams or
Sender: TObject
Column: TColumnEh
AFont: TFont
Font that will be used to paint a cell. You can change the font
properties to specify properties of the new font rendering.
The background color that will be used to paint a cell. You can
change this parameter to specify a new color.
State: TGridDrawState
TColumnEh.OnGetCellParams
Write OnGetCellParams event to set such parameters as Font, cell color or other parameters of
cell before cell will be drawn. If it is needed to change parameters only in a specified column
then use column event - TColumnEh.OnGetCellParams. In this event you may change Font,
Color, Alignment, ImageIndex, Text, checkbox's state and also such properties of a Params
parameter as:
BlankCell: Boolean. Set this property to true to show cell as an empty cell with 3D
border.
SuppressActiveCellColor: Boolean. Set this property to forbid the color of active cell to
overlay the color that is set in Background property.
TextEditing: Boolean. Set this property to forbid showing of cell text editor.
These events are also called when grid request Font and Color for inplace editor.
If you want to draw data by yourself use OnAdvDrawDataCell event.
Use this event to replace the cell parameters for particular column before rendering. This event
has an expanded set of parameters compared to the TDBGridEh.OnGetCellParams event.
This event is fired, not only before rendering a grid. In some cases, the event is called to request
additional cell parameters. For example, before opening InplaceEditor grids causing the event
and check Params.TextEditing option to allow you to open InplaceEditor for the current cell.
The event has the following parameters TColumnEh.OnGetCellParams:
Sender: TObject
EditMode: Boolean
Params: TColCellParamsEh
Params.Alignment: TAlignment
Text alignment.
Params.Background: TColor
background color
Params.BlankCell: Boolean
Params.SuppressActiveCellColor:
Boolean
Params.CheckboxState:TCheckBoxState
Params.Col: Longint
Params.CellRect: TRect
Params.Font: TFont
Params.ImageIndex: Integer
Params.ReadOnly: Boolean
Params.Row: Longint
Params.State: TGridDrawState
Cell status
Params.Text: String
Params.TextEditing: Boolean
Params.DrawCellByThemes:Boolean
Params.TextIsLink: Boolean
Params.ImageIsLink: Boolean
Set Column.WordWrap to True value to break a long text in data row to a multiline. In reality,
text will be wrapped only when height of row is bigger than height of one text line.
var Processed: Boolean Set Processed in True to indicate that you have been
treated in a reaction event and call the default handler is
not necessary.
In the event you can call the default handler - TCustomGridEh. DefaultCellMouseClick.
Useful methods and properties for obtaining data on the area of the grid in which the event
occurred:
function GetCellAreaType(ACol, ARow: Integer; var AreaCol, AreaRow:
Integer): TCellAreaTypeEh;
get the type of horizontal and vertical grid area in which the event occurred.
Horizontally the grid is divided into the following areas:
hctIndicatorEh
Indicator area
hctDataEh
Data area
Vertically the grid is divided into the following areas:
vctTitleEh
header area
vctSubTitleEh
The area under the heading filter
vctDataEh
data area
vctAboveFooterEh The area between the footer and data
vctFooterEh
footer area
TDBGridEh.OnGetBtnParams
Event occurs by clicking on the header and is used for special painting of a pressed title.
TDBGridEh.OnTitleBtnClick
The event is called when you click in the header area that is configured to work as a button. To
trigger events in the header the Column.Title.TitleButton property should be set to True.
TDBGridEh.OnTitleClick
The event is called when you click in the header area.
Setting color dividing lines, the presence / absence of lines in various areas Grid.
Next properties are responsible for the presence of lines and colors in the grid:
Presence / absence of values dgColLines, dgRowLines in property TDBGridEh.Options:
Set the presence of vertical and horizontal lines for the Grid in general.
Sub-properties of the property TDBGridEh.GridLineParams:
Using sub-properties of this property you can control the color of the dark lines in the grid
(DarkColor) and the color of bright lines (BrightColor), the color of the lines in the data,
the presence of lines of data, and the color scheme of the lines.
Sub-properties of the property TDBGridEh.GridLineParams
Property Name
DarkColor
Property Type
TColor
BrightColor
TColor
DataVertColor
DataVertLines
DataHorzColor
DataHorzLines
DataBoundaryColor
TColor
Boolean
TColor
Boolean
TColor
GridBoundaries
Boolean
ColorScheme
TDBGridLines
ColorSchemeEh
Description
Color dark lines. Used for areas of fixed cells, as well
as areas within the meaning of which is meant shading
dark lines.
ClDefault value determines what color will be
determined automatically based on the current color
scheme, the properties of Grid.Flat and activity of
global change Themes.Active.
Color bright lines. Used for data areas, and areas
within the meaning of which is meant shading light
lines.
ClDefault value determines the color will be
automatically detected similarly DarkColor.
Color vertical lines in the data area.
The existence of vertical lines in the data.
Color of the horizontal lines in the data area.
The presence of horizontal lines in the data.
Painted boundary lines grid (not to be confused with
the client area) color DarkColor.
Paint boundary lines grid (not to be confused with the
client area) color DarkColor.
Property determines the color scheme used to draw
the dividing lines for which a color clDefault.
Property can contain the following values:
glcsDefaultEh - Use the default color
scheme.
VertEmptySpaceStyle TDrawEmpty
SpaceStyle
TDBGridEh.TitleParams.VertLineColor: TColor
TDBGridEh.TitleParams.VertLines: Boolean
TDBGridEh.TitleParams.HorzLineColor: TColor
TDBGridEh.TitleParams.HorzLines: Boolean
TDBGridEh.IndicatorParams.HorzLineColor: TColor
TDBGridEh.IndicatorParams.HorzLines: Boolean
TDBGridEh.IndicatorParams.VertLineColor: TColor
TDBGridEh.IndicatorParams.VertLines: Boolean
TDBGridEh.FooterParams.HorzLineColor: TColor
TDBGridEh.FooterParams.HorzLines: Boolean
TDBGridEh.FooterParams.VertLineColor: TColor
TDBGridEh.FooterParams.VertLines: Boolean
RowPanel mode.
Grid can work in special mode when every cell of grid can be placed under each other and can
have individual height. Set RowPanel.Active to True value to activate this mode. At design-time
you can place cell, vertical
and horizontal size. At runtime the possibility to
change position of cell
depends on the presence
dghColumnMove value in
OptionsEh
property.
Possibility
to
change
vertical size of cell depends
on
RowSizingAllowed
property.
When user change cell width, the grid also changes width of adjoined cells which are placed
under or above of changing cell and if the right border of these cells match. By analogy when
user changes cell height, grid changes height of cells in left or right part of grid if low borders
march. Press and hold Shift key to change the size of only single cell.
To change cell height of cell you need to move mouse cursor to the low border of the title cell.
Mouse cursor will change its image from arrow to two arrows with up and down direction. At
this moment press right mouse button and change size.
To change position of cell you need to press right mouse button on the title cell and drag it to
the required place.
Additional subproperies of the RowPanel property:
NavKeysNavigationType: TGridRowPanelNavKeysNavigationTypeEh defines the order of navigation
over cells in the grid when keys Up, Down, Left, Right are pressed.
rpntRowToRowEh - (by default) Keys Up, Down move current cell to next or previouse record of
dataset. Keys Left, Rigth worksas Tab and Shift-Tab.
rpntCellToCellEh Keys Up, Down move current cell to under or above last position from the
current cell. Keys Left, Rigth move current cell to left or right position from the current cell.
TabNavigationType: TGridRowPanelTabNavigationTypeEh
element of the grouping collection is active when its ColumnName property holds a name of a
column. After activation of grouping panel, you can make and change the grouping structure
using drag-n-drop operations. Drag the column title to the grouping panel to group data by this
column. In time of forming the tree of grouping, grid creates the new group record when the
value of the field of column Column.Field is changed. You can change key value of grouping in
the event TDBGridEhDataGroupLevelEh.OnGetKeyValue or TColumnsEh.OnGroupGetKeyValue.
Take current value of the key value from the field GroupLevel.Column.Field.Value. Write the
changed value to the KeyValue parameter of the event procedure.
For example, next event will form tree of grouping that will have only two grouping records Big and Small for
numeric field that have record values that bigger or smaller them 100.
procedure TForm1.gridFishColumns6GroupGetKeyValue(Sender: TCustomDBGridEh;
Column: TColumnEh; var KeyValue: Variant);
begin
if Column.Field.AsFloat > 100 then
KeyValue := 'Big'
else
KeyValue := 'Small';
end;
Grid uses key value to form string that will be shown in the grouping row. If you changed key
value of the grouping, then you likely need to change algorithm that convert key value to
display value for display. Write OnGetKeyValueAsText event to do it. Write
Grid.OnDataGroupGetRowText and GroupLevels.OnGetGroupRowText to rewrite the algorithm
of forming the text that is shown in the grouping row.
Use property Grid.DataGrouping.GroupDataTree to access the items of grouping tree. The
property have the TGridGroupDataTreeEh type and is inherited form TTreeListEh. The itmes of
TTreeListEh class form the tree-type structure of groups and references to DataSet records for
the lowest levels of grouping. Use properties FlatVisibleCount and FlatVisibleItem[Index] to
access items as a flat list. The flat list FlatVisibleItem contain only items which are in the scope
of the expanded nodes. Amount of items in flat array corresponds amount of rows in the grid.
Every item of array is a reference to the instance of TGroupDataTreeNodeEh class and defines a
node in the grouping tree. Basic properties of this class are:
Count: Integer;
Amount of nodes in the group. Nodes can be over groups of lower level or references to
dataset records.
DataGroup: TGridDataGroupLevelEh
Reference to item of grouping structure. Not empty if the node is a node of group.
DataSetRecordViewNo: Integer.
Number of record in MemTableEh. Not empty if the node is a node of the dataset
record.
Expanded: Boolean.
Node is expanded.
Items[Index: Integer]: TGroupDataTreeNodeEh.
List of nodes of the lower level.
KeyValue: Variant;
Level: Integer
The number of node level;
NodeType: TGroupDataTreeNodeTypeEh.
Type of the node. The Node of a group level or a record level.
Parent.
A pointer to the parent branch.
Use Items property of Grid.DataGrouping.GroupDataTree to access the grouping tree as a treetype structure. Every item of this list is a reference to a tree node of grouping of highest level.
Grid.DataGrouping property has next subproperties:
Active: Boolean
Collection of the grouping structure. Use this property to define template of grouping.
GroupPanelVisible: Boolean
Set this property to True to show panel of grouping in the top part of the grid. When the
panel is visible you can form the structure of grouping by dragging the title of the
column onto this panel.
Font: TFont
Font: TFont;
// Font of the text
Images: TCustomImageList; // ImageList to show images
ImageIndex: Integer;
// Index of a image from the ImageList.
GroupRowText: String;
// Text to show in the cell of the group
State: TGridDrawState; // Readonly property. Draw state.
DBGridEh allows you to customize headers groups including the following string parameters:
height, font and color of the grouping records, and the thickness and color of a horizontal
dividing line.
In the group is allowed to display a grid summarizing the records for each group, and the overall
record summarizing the bottom of the grid.
Each
item
in
the
collection
TDBGridEh.DataGrouping.Footers in turn, is a collection of items ReadOnly footer
corresponding to each of the columns of the grid. When you create a new collection Footer,
Footers system automatically populates a collection of Footer and the number of columns in
the grid. After creating a new Footer you must select the item if you want to specify a footer,
and an aggregate function to count. The function type is defined in the Footer.ColumnItems
[i].ValueType. ShowFunctionName property determines whether to display the values to the
In the group the data grid allows to calculate the value of the elements in the footer of the
event. This allows for aggregation functions of any complexity. For each entry DataSet called
OnDataGroupFooterAggregateValue event in which to calculate the current value of the
aggregate value of the event is given for each DataSet 'entry.For example, the function sum
must be added the current field value to the counter sum
procedure TfrMailBox.DBGridEh1Columns5DataGroupFooterAggregateValue (
Grid: TCustomDBGridEh; Column: TColumnEh;
GroupFooter: TGridDataGroupFooterEh;
FooterColumnItem: TGridDataGroupFooterColumnItemEh; var AValue: Variant;
Node: TGroupDataTreeNodeEh; var Processed: Boolean);
begin
if VarIsEmpty (AValue) then
begin
AValue: = VarArrayCreate ([0,1], varInteger);
AValue [0]: = 0;
AValue [1]: = 0;
end;
if MemTableEh1post_read.AsInteger = 1
then AValue [0]: = AValue [0] + 1
else AValue [1]: = AValue [1] + 1;
Processed: = True;
end;
After all calls OnDataGroupFooterAggregateValue events for each record dataset process
causes the event the aggregate value of final settlement - ColumnEh.
OnDataGroupFooterFinalizeValue. If implemented feature requires a final step to calculate a
value, it can be done in this event.
For example, to calculate the average value of the function at the final step of the calculation
necessary to cut the sum of the number of records.
SumValue / RecordsCount
To implement this functionality, you need to calculate the variable to store two values: the sum
of the number of records.For this purpose, the calculation of the variable AValue: Variant can
make an array of two values, and in the function of the final payment, divide the first element of
the array (sum) to the second element (number).
SumValue / RecordsCount
To implement this functionality, you need to calculate the variable to store two values: the sum
of the number of records.For this purpose, the calculation of the variable AValue: Variant can
make an array of two values, and in the function of the final payment, divide the first element of
the array (sum) to the second element (number).
When the value of a cell footer display is converted a value to a text representation of
OnDataGroupFooterToDisplayText.
Events
OnDataGroupFooterAggregateValue,
OnDataGroupFooterFinalizeValue
OnDataGroupFooterToDisplayText and declared in the class and TDBGridEh TColumnEh.
Event Name/
Type
Parameter Name
OnDataGroup FooterAggregateValue
Description
Called for each record dataset. In the event
it is necessary to perform the next step of
Grid
Column
GroupFooter
FooterColumnItem
var AValue
Node
var Processed
OnDataGroupFooterFinalizeValue
Grid
Column
GroupFooter
FooterColumnItem
var AValue
var Processed
TCustomDBGridEh
TColumnEh
TGridDataGroup
FooterEh
TGridDataGroup
FooterColumnItemEh
Variant
Boolean
OnDataGroupFooterToDisplayText
Grid
Column
TCustomDBGridEh
TColumnEh
GroupFooter
FooterColumnItem
TGridDataGroupFooterEh
TGridDataGroup
FooterColumnItemEh
Variant
string
Boolean
var AValue
var DisplayValue
var Processed
1. Summation via SumList using subproperties TDBGridEh.SumList and setup functions through
summation TColumnEh.Footer.
2. Summation via the functional grouping records when TDBGridEh.DataGrouping.Actitve =
True.
These two features are independent of each other. Configure one functionality does not affect
the other. However it is recommended to use only one feature at a time.
Summation over SumList works for any type of dataset, while grouping records only works
when plugged into the grid TMemTableEh. But adding a SumList there is a drawback concerning
data types. SumList technology keeps the total values in the variables of type Currency. Ie the
maximum number of digits after the decimal point for the summation of values = 4.
Summation by grouping records using generic type Variant, and also allows the use of nonstandard
algorithms
for
aggregation
through
events.
Summation by grouping records also allows to sum without having to create groups. To make
the sum with no groups, activate the group - DataGrouping.Active = True, the elements of the
collection to create footers - DataGrouping.Footers, but do not enable the panel grouping
DataGrouping.GroupPanelVisible = False. In this case, for each of the items in the collection will
be displayed one footer at the bottom of the grid entry.
Property Type
Boolean
Picture
Placement
TPicture
TImagePlacementEh
Description
Specifies whether the Background Pciture is visible in
the grid.
The Pciture to draw as a Background Data.
Specifies the position of the image and the way of
filling the free space
TImagePlacementEh = (
ipTopLeftEh,
ipTopCenterEh,
ipTopRightEh,
ipCenterLeftEh,
ipCenterCenterEh,
ipCenterRightEh,
HorzMargin
VertMargin
ExcludeTitle
ExcludeIndicator
ExcludeFooter
Integer
Integer
Boolean
Boolean
Boolean
ipBottomLeftEh,
ipBottomCenterEh,
ipBottomRightEh,
ipFillEh,
ipFitEh,
ipStretchEh,
ipTileEh);
Horizontal Shift
Vertical Shift
Delete the title of the fill graphic background.
Delete button from the fill graphic background.
Delete the footer of the fill graphic background.
You can override the global method of assigning a dialog box pointer to the global
process
var
ExecuteDBGridEhFindDialogProc: TExecuteDBGridEhFindDialogProc;
You can redefine the key combination to display the dialog box by assigning a new
combination of a global variable DBGridEhFindDialogKey: TShortCut. The variable
declared in the module DBGridEh.
Incremental search in the column Search while typing in the column grid.
TDBGridEh allows users to make a special "incremental" searches column grid. When
the user enters an incremental search, he can type characters. This grid will tries to find
typed text in the current column. Use dghIncSearch and dghPreferIncSearch values
(property OptionsEh) for controlling an incremental search. At runtime, you can use the
following keyboard shortcuts for incremental search:
Ctrl+F - start incremental search.
Ctrl+Enter - Find next match.
panel,
search
and
filter
properties
using
sub-properties
DBGridEh.SearchPanel: TDBGridSearchPanelEh
Sub-properties properties TDBGridEh.Border:
Property Name
Enabled
Property Type
Boolean
Description
Set the Enabled property to True to activate the
search and filter of the panel. Activate the Panel still
does not mean that it will be immediately visible in
the grid. Panel's visibility is set through property
PersistentShowing.
PersistentShowing Boolean
Specifies that the search panel always visible in the
grid. If PersistentShowing = False, the panel
becomes visible after pressing the key combination
to activate the search through the panel in the
property ShortCut.
ShortCut
TShortCut
Specifies the key combination to activate the search
panel and give focus to the input text editor search
bar. Defaults to "Ctrl + F".
Location
TSearchPanelLocationEh Location of the search panel. Can take the following
values:
splGridTopEh - Search panel at the top of the
grid above the title.
splHorzScrollBarExtraPanelEh - Search panel is
in the "extra-bar" thumb scroll horizontally.
The search panel works correctly in this
location, "extra-panel" slider is visible.
splExternal - Search panel is outside the grid.
In this mode, the algorithm of the search
panel and drawing the sole responsibility of
the developer.
FilterOnTyping
Boolean
Specifies that the grid will filter data as you enter
text in the text editor panel of the search. If
FilterOnTyping = False then the data will be filtered
only by pressing the key Enter or click the Apply
Filter button in the search panel.
FilterEnabled
Boolean
Specifies that filter is available in the search panel.
Customizing scrollbars.
You can control the horizontal and vertical scrolling bar
using the Grid.VertScrollBar and Grid.HorzScrollBar
properties of TGridScrollBarEh type.
The TGridScrollBarEh class contains the following
properties:
Property Name
Property Type
Description
Tracking
Boolean
Visible
Boolean
SmoothStep
Boolean
Sets the scroll step of the grid in which the grid is not
specified on the border of the cell, and pixel-by-pixel.
When SmoothStep, the grid visually scroll more
TScrollBarVisibleModeEh
Height
Integer
Width
Integer
For the vertical scroll bar sets the width of the strip.
For horizontal scroll feature is not available.
ExtraPanel
TDBGridEhScrollBarPanel
ExtScrollBar: TScrollBar;
Visible: Boolean;
VisibleMode: TScrollBarVisibleModeEh;
sbAlwaysShowEh
Always shows scrollbar.
sbNeverShowEh
Never shows scrollbar.
sbAutoShowEh
Shows or hides scrollbar automatically
depending on visible area of grid.
If grid is connected to DataSet of TMemTableEh type then on vertical scrolling grid doesnt
change position of active record.
Property Type
Boolean
NavigatorButtons
TNavButtonSetEh
VisibleItems
TGridSBItemsEh
Description
Set the Visible property to True to display additional
panel horizontal ScrollBar
Use the NavigatorButtons property to determine
which navigation buttons will be visible in the
database navigator.
TNavigateBtnEh = (nbFirstEh, nbPriorEh,
nbNextEh, nbLastEh, nbInsertEh,
nbDeleteEh, nbEditEh, nbPostEh,
nbCancelEh, nbRefreshEh);
TNavButtonSetEh = set of TNavigateBtnEh;
Use VisibleItems property to determine which items
will be visible in the panel.
TGridSBItemEh = (gsbiRecordsInfoEh,
gsbiNavigator, gsbiFindEditorEh,
gsbiSelAggregationInfoEh);
TGridSBItemsEh = set of TGridSBItemEh;
Displaying the search for extra-panel runner is configured through the properties of the search bar
Grid.SearchPanel.
Clicking on the navigation button event fires NavigatorPanelButtonClick event. The event is passed the
type of button AButton: TNavigateBtnEh. In the event handler, you can set the Processed parameter
to True to avoid calling of the default handler.
DBGridEh allows you to customize the color and display side border (Border) of the client area Grid.
Sub-properties of property TDBGridEh.Border:
Property Name
Color
Ctl3D
Property Type
Boolean
Boolean
EdgeBorders
TEdgeBorders
ExtendedDraw
Boolean
Style
TBorderStyle
Description
Background color fringing.
Specifies that the line shall be drawn in 3D. Top and
left border darker color. Bottom and right lighter.
EdgeBorders property is set (set) that indicates which
side of border drawn. A set can contain a combination
of the following - ebLeft, ebTop, ebRight, ebBottom.
Use ExtendedDraw property to establish that border
will be drawn through the inner grid instead by
standard features of the functional Windows.
Color properties and EdgeBorders are taken into
account only when ExtendedDraw = True.
Style edging. It can take values bsNone and bsSingle.
end;
Demo:
folder
While lsftBeginsWithEh, the program displays only those records where the beginning of the
text in the list coincides with the beginning of the text in the editor. In this example, the list will
show all records that have a company name begins with Un. As you type, the number of
entries in the list is reduced.
While lsftContainsEh program displays only records that have the typed text is in any position
of the first column of the combo box. In this case, the found text is highlighted in color.
To filter the data in drop-down lists to lookup:
- Assign property DropDownBox.ListSource (TColumnEh. DropDownBox.ListSource or
DBLookupComboboxEh.DropDownBox.ListSource). DropDownBox.ListSource must refer to the
DataSource which DataSource.DataSet a separate DataSet that will filter the data. Filtering is
done through the property DataSet.Filter: = '[FieldsName] Like abc *' or '* abc *' depending on
the mode (lsftBeginsWithEh and lsftContainsEh). As an icon substitution Wildcard default is '*'.
If your DataSet supports different icon for Wildcard Like expressions, you must register the
class derived from TSQLDatasetFeaturesEh where overloaded virtual function
GetLikeWildcardForSeveralCharacters. Standard datasets such as TADODataSet, TClientDataSet,
etc. Such classes are already written and recorded automatically if the partition uses any design
unit prescribe the appropriate module EhLibXXX (EhLibADO, EhLibCDS, etc.) in the same way as
for setting sorting and filtering in the grid.
- Enable filtering typing: DropDownBox.ListSourceAutoFilter = True.
- Set the mode filtering: DropDownBox.ListSourceAutoFilterType = lsftBeginsWithEh or
DropDownBox.ListSourceAutoFilterType = lsftContainsEh.
DataSet
Local sorting
Server sorting
Local filtering
Server filtering
EhLibBDE
TQuery,
N
Y
Y
Y
TTable
EhLibADO
TADOQuery,
Y
Y
Y
Y
TADODataSet
EhLibCDS
TClientDataSet
Y
Y
Y
Y
EhLibDBX
TSQLQuery,
N
Y
N
Y
TSQLDataSet
EhLibIBX
TIBQuery,
N
Y
Y
Y
TIBDataSet
EhLibMTE
TMemTableEh
Y
Y*
Y
Y*
* If Grid is configured for Server sorting of Filtering (SortLocal=False, STFilter.Local=False), then
sort operation is transferred to the TMemTableEh.DataDriver object.
When grid is adjusted for a local filtering, the special object will build expression and assign it to
a property Filter of DataSet. So we need also to set Filtered to True value manually.
When grid is adjusted for a server filtering, the special object will build SQL:ORDER BY
expression and it will replace ORDER BY string in SQL or Command property of DataSet and it
will reopen DataSet.
When grid is adjusted for a local sorting, the special object will perform a sorting using
specific type of DataSet.
When the grid is adjusted for a server sorting, the special object will build expression for SQL
'WHERE' clause in SQL string of dataset. It will try to find string that begins from key string
'/*Filter*/' in SQL expression and adds filter expression after this string in same line (You can
change this key string using global variable - SQLFilterMarker) . So your SQL query must have a
line that begins from '/*Filter*/'. For instance:
' select *
from table1
where
/*Filter*/ 1=1 '
For automatically filtering/sorting data in dataset you need to add one of the units EhLibXXX
(EhLibADO, EhLibBDE, EhLibCDS ... depend on the type of dataset where the grid is linked to) to
'uses' clause of any unit of your project. This units have code to register TDatasetFeaturesEh
based classes (special object) for respective DataSet's. For other third party DataSet's you have
to write and register your own special object or you have to write OnApplyFilter or/and
OnSortMarkingChanged events for every required grid. Moreover, you can write
OnApplySorting and/or OnApplyFilter for the global variable DBGridEhDataService. These
events have TNotifyEvent type where Sender is TCustomDBGridEh.
(Expression in the cell can look like: "1", ">=1", ">1 AND <=5", "%TestStr%"). Set STFilter.Visible
to True value to show this special row. AT Run time, when cursor locate in the filter cell, they
can press ENTER to apply filter. Grid will parse expression in every not empty filter cell and call
TDBGridEh.ApplyFilter. And it calls OnApplyFilter event or passes action to special object, if it is
registered.
For normally parsing, the expression in cell have to have next format:
[Operator1] Operand1 [)] [AND|OR Operator2 Operand2 [)] ]
Where OperatorX is one of [ = | <> | != | > | < | >= | <= | ~ | !~ | in ( ]
OperandX is a numeric, date or string value or for the operator 'IN' it is a list of values divided
by comma.
For instance:
'1'
'>=1'
'>1 AND <=5'
'~ TestStr%'
'!~ TestStr_'
'in (1,2,3,4,5,6) and >100'
'in (Str1,Str2,Str3)'
Grid allows to show dropped down list of STFilter in title cells. Set STFilter.Location to
stflInTitleFilterEh to active this mode. Use item (Custom) to enter string for filtering or press
checkboxes above required values. Global variable DBGridEhShowInTitleFilterBox contain key
combination for opening list of filtering values. By default it contains 'Ctrl-T'.
When grid is connected to the list of uncial values of column is formed automatically. In
addition, list is formed with tacking in account of filter applied in other columns. To form list of
values and command for filtering, use next events and methods: Events TDBGridEh.OnFillSTFilterListValues,
TColumnEh.OnFillSTFilterListValues,
TDBGridEhCenter.OnFillSTFilterListValues
or
rewrite
method
TDatasetFeaturesEh.FillSTFilterListDataValues and register new class MyDatasetFeaturesEh for
interaction between grid and dataset.
Grid call event OnFillSTFilterListValues every time when it is needed to fill list of StFilter, that have
next type:
TDBGridEhFillSTFilterListValuesEvent = procedure(Sender: TCustomDBGridEh; Column: TColumnEh; Items:
TStrings; var Processed: Boolean) of object;
Item of the list show sorting item Asc and executes sorting in ascending order.
PopupListboxItemEhSortDes: TPopupListboxItemEhSort;
Item of the list show sorting item Asc and executes sorting in descending order.
PopupListboxItemEhLine: TPopupListboxItemEhLine;
Item of the list show horizontal line. On choosing doesn't perform any actions.
PopupListboxItemEhClearFilter: TPopupListboxItemEhSpec;
PopupListboxItemEhAll: TPopupListboxItemEhSpec;
PopupListboxItemEhEmpties: TPopupListboxItemEhSpec;
PopupListboxItemEhNotEmties: TPopupListboxItemEhSpec;
PopupListboxItemEhDialog: TPopupListboxItemEhSpec;
PopupListboxItemEhApplyFilter: TPopupListboxItemEhSpec;
PopupListboxItemEhData: TPopupListboxItemEhData;
Item of the list shows text that defines text of filtering. When it is selected, it is checked
by checkbox and it is put in the list of items of values that is needed be in the filtered
records.
You can call next methods in the event to fill values by default
TDBGridEh.DefaultFillSTFilterListValues(Column: TColumnEh; Items: TStrings)
TDBGridEh.DefaultFillSTFilterListCommandValues(Column: TColumnEh; Items: TStrings)
TDBGridEh.DefaultFillSTFilterListDataValues (Column: TColumnEh; Items: TStrings)
Next code show OnSTFilterListValues event where sorting items is deleted from list:
procedure TForm1.DBGridEh1FillSTFilterListValues(Sender: TCustomDBGridEh;
Column: TColumnEh; Items: TStrings; var Processed: Boolean);
var
Index: Integer;
begin
Sender.DefaultFillSTFilterListValues(Column, Items);
Index := Items.IndexOfObject(PopupListboxItemEhSortAsc);
if Index >= 0 then
Items.Delete(Index);
Index := Items.IndexOfObject(PopupListboxItemEhSortDes);
if Index >= 0 then
Items.Delete(Index);
Processed := True;
end;
Now library can fill list of unical values only for DataSet of TMemTableEh type. To fill values
when grid is connected to other type of
DataSet, it is required rewrite
TDatasetFeaturesEh.FillSTFilterListDataValues method and , if it is need, it is required to register
class that inherited from TDatasetFeaturesEh. Read information about TDatasetFeaturesEh
class in EhLib users guide and EhLibMTE.Pas.
New
properties
STFilterDefaultStringOperator,
STFilterDefaultNumberOperator,
STFilterDefaultDateTimeOperator,
STFilterDefaultBooleanOperator
are
added
in
TDBGridEhCenter class.
Use this properties to set default operator that will be used when
string in the STFilter doesn't containt operator. The operators can be assigend appart for String
fields, Numeric fields, DataTime fields and logical fields.
Property Type
TColor
Description
Specifies the background color for the title cells.
Font
TFont
ParentFont
Boolean
SecondColor
TColor
Images
TCustomImageList
MultiTitle
Boolean
RowHeight
RowLines
Integer
Integer
SortMarkerStyle
VTitleMargin
TSortMarkerStyleEh
Integer
VertLineColor
VertLines
HorzLineColor
HorzLines
FillStyle
BorderInFillStyle
TColor
Boolean
TColor
Boolean
TGridCellFillStyleEh
Boolean
Complex titles.
TDBGridEh allows to create one common title above several columns. See Figure:
To do it, set DBGridEh.UseMultiTitle property to True value and fill label of the fields or caption
of column title using next rule: every part of text in field label or column title must consist of
several parts divided by sign "|", where every common part must be same for several required
columns. Other fields or captions must contain same text
in the corresponding parts.
For example:
Field1.DisplayLabel := 'Title1|SubTitle1';
Field2.DisplayLabel := 'Title1|SubTitle2';
or
DBGridEh.Columns[0].Title.Caption := 'Title1|SubTitle1';
DBGridEh.Columns[1].Title.Caption := 'Title1|SubTitle2';
Sorting markers
Change the sort order for the marker sorting. In the new version make the p-triangle sorting pointing
down means sorting type DESC (from highest to lowest). The first sort direction is determined by the
type of field. For text fields, the first sort order is set to high for the rest of the fields in descending
order. To change the direction of the first rewrite virtual function use
TDBGridEhCenter.GetFirstSortMarkerState. To install the new center Grids use the global
function SetDBGridEhCenter.
You can set the icon sorting through properties TDBGridEh.TitleParams. SortMarkerStyle for a
particular grid or through global property DBGridEhDefaultStyle.SortMarkerStyle.
type TSortMarkerStyleEh:
smstDefaultEh
- Use steel default defined in
DBGridEhDefaultStyle.SortMarkerStyle
smstClassicEh
smst3DFrameEh
smstFrameEh
smstSolidEh
smstThemeDefinedEh
Property Type
TColor
TColor
Boolean
TColor
Boolean
TGridCellFillStyleEh
Integer
Description
Specifies the background color for the indicator color.
Color of the horizontal lines in the data area.
Presence of horizontal lines in the data area.
Color vertical lines in the data area.
Presence of vertical lines in the data area.
Specifies the style of filling the indicator cells.
If set to gioShowRecNoEh IndicatorOptions (Also the
same as in dghShowRecNo OptionsEh), then this
property specifies step with which to show record
numbers in the column display. For records that fall
between steps, the record number is displayed
instead of a point. This eliminates the effect of
"flickering" numbers, which can occur when displaying
each record number.
Property Type
TColor
TGridCellFillStyleEh
TFont
ParentFont
Boolean
Description
Specifies the background color for the footer color.
Specifies the style of filling the footer cells.
Controls the font in which the title cells displays its
data.
Determines where a control looks for its font
RowHeight
RowLines
Integer
Integer
HorzLineColor
HorzLines
VertLineColor
VertLines
TColor
Boolean
TColor
Boolean
information.
Specifies the height of footer row in text lines
Specifies the height of footer row in text lines
Full row height = height in pixels of RowLines +
RowHeight.
Color of the horizontal lines in the footer area.
Presence of horizontal lines in the footer area.
Color vertical lines in the footer area.
Presence of vertical lines in the footer area.
Property Type
Description
Active
Boolean
ExternalRecalc
Boolean
VirtualRecords
Boolean
Property Type
Description
Alignment
TAlignment
Color
TColor
DisplayFormat
String
EndEllipsis
Boolean
FieldName
String
Font
TFont
ToolTips
Boolean
Value
String
ValueType
TFooterValueType
WordWrap
Boolean
Use DBGridEh.OnGetFooterParams event in order to control the parameters of the cell footer
draw operation.
procedure TForm2.DBGridEh2GetFooterParams(Sender: TObject; DataCol,
Row: Integer; Column: TColumnEh; AFont: TFont; var Background: TColor;
var Alignment: TAlignment; State: TGridDrawState; var Text: string);
begin
end;
In the event you can change property values AFont, Background, Alignment, Text to change the
text and text fortmat footer cell before rendering.
Use the following methods and properties when using the footer:
function
TDBGridEh.GetFooterValue(Row:
Integer;
Column:
TColumnEh): String;
The method returns a string value in the footer for a column definition.
Parameter Row sets the row number footer (FooterRowCount be more than 1).
Column specifies the column for which it is necessary to obtain the value of the
footer.
Property Type
Boolean
Local
Boolean
Location
TSTFilterLocationEh
Visible
Color
Font
Boolean
TColor
TFont
ParentFont
Boolean
Description
Defines if filter will be applied on chanching or clising
of droped down list of filtered values (STFilter)
Grid does not use it, but object that perform filtering
can determine whether it will filter locally in dataset
or on the server (by adding filter expressions in SQL
'WHERE' clause)
Defines the location STFilter. Under the title
(stflUnderTitleFilterEh) or in the title
(stflInTitleFilterEh). When in the title then STFilter
doesn't support edit line to enter filter expression.
Specifies whether the filter row is visible.
Specifies the background color for the title cells.
Controls the font in which the title cells displays its
data.
Determines where a control looks for its font
HorzLineColor
RowHeight
RowLines
TColor
Integer
Integer
VertLineColor
TColor
FilterButtonDrawTime TDBGridFilter
ButtonDrawTimeEh
information.
Color of the horizontal lines in the footer area.
Specifies the height of footer row in text lines.
Specifies the height of footer row in text lines
Full row height = height in pixels of RowLines +
RowHeight.
Color vertical lines in the footer area.
Specifies when it is to draw buttons for DropedDown
filter list.
ShowTree
Lines
Boolean
tvgsClassicEh
tvgsThemedEh
tvgsExplorerThemedEh
Set this property to True to display the lines connecting the
elements of the tree.
True):
TDBGridEhExportAsXlsx To export data in the format Xlsx. The export is performed directly to
a file. The presence of additional libraries are not required.
Unloading Supported in Delphi XE2 and higher. For working of class unloading in earlier
versions of Delphi you must use the third-party tools to form the Zip file version 2. For more
information about unloading format Xlsx for Delphi XE2 version below read in the files section
<EhLib Archive>\ ZipProviders\
Also for export, you can use a global procedure
procedure ExportDBGridEhToXlsx(DBGridEh: TCustomDBGridEh;
const FileName: String; Options: TDBGridEhExportAsXlsxOptions; IsSaveAll:
Boolean = True);
Set TitleButton property to True value to make top-left cell working as button. When
TitleButton is True the properties DropdownMenu and UseGlobalMenu are also taken into
consideration. If UseGlobalMenu is True then grid will form the dropped down menu using
global property DBGridEhCenter.IndicatorTitleMenus.IndicatorTitleMenus. If DropdownMenu is
also assigned then all elements of this menu will be added to the dropped down menu after
elements of global menu.
Subproperies of IndicatorTitle property:
property DropdownMenu: TPopupMenu;
Identifies the pop-up menu, which elements will be displayed when IndicatorTitle cell is
clicked.
property ShowDropDownSign: Boolean default False;
Determines whether to display the black triangle in upper left when cell of the grid.
property TitleButton: Boolean;
Determines whether the upper left cell works as button.
property UseGlobalMenu: Boolean default True;
Determines whether grid will take into account the
DBGridEhCenter.IndicatorTitleMenus property to form drop down menu.
TDBGridEh.IndicatorTitle property have the following sub-properties:
Property Name
Property Type
Description
DropdownMenu
TPopupMenu
ShowDropDownSign Boolean
TitleButton
TitleButton
UseGlobalMenu
Boolean
Determines whether the SubTitleFilter will be applied right after choosing value from
dropped down list or always need to press Enter key to apply filter.
property IndicatorTitleMenus: TDBGridEhStyleIndicatorTitleMenusEh;
Specifies the list of elements, which will be visible in IndicatorTitle of dropped down
menu when TDBGridEh.IndicatorTitle.UseGlobalMenu = True and
TDBGridEh.IndicatorTitle.TitleButton = True.
TDBGridEhStyleIndicatorTitleMenusEh is a set which consists of following values
itmVisibleColumnsEh - Display the menu item with list of columns, cliquing on
which possible to show or hide column.
itmCut
- Display Cut menu item
itmCopy
- Display Copy menu item
itmPaste
- Display Paste menu item
itmDelete
- Display Delete menu item
itmSelectAll
- Display SelectAll menu item
Events:
OnApplyFilter: TNotifyEvent;
This event is called when grid apply SubTitleFilter. Sender parameter is a grid that
applies filter. In the handler of event you can call default handler DBGridEhCenter.DefaultApplyFilter.
OnApplySorting: TNotifyEvent;
This event is called when grid apply sorting. Sender parameter is a grid that applies
sorting. In the event handler you can call default handler DBGridEhCenter.DefaultApplySorting.
OnBuildIndicatorTitleMenu: TDBGridEhBuildIndicatorTitleMenu;
This event occurs when grid forms the dropped down menu that appears when mouse is
clicked on the upper left cell of grid. Event occurs if TDBGridEh.IndicatorTitle.TitleButton =
True. Sender parameter is a grid in which IndicatorTitle button was pressed. PopupMenu
parameter is a menu that will is displayed under cell. You can call default handler that build
menu items by default:
DBGridEhCenter.DefaultBuildIndicatorTitleMenu(Grid, PopupMenu);
and then perform additional code, for instance, to add one more menu elements.
// Below is an example that demonstrate how to add new menu item in list of
IndicatorTitle menus.
// Declare global menu item for printing the grid.
var DBGridEhPreviewIndicatorMenuItem: TDBGridEhMenuItem;
// In public section of main Form declare methods for OnBuildIndicatorTitleMenu
event.
procedure BuildIndicatorTitleMenu(Grid: TCustomDBGridEh; var PopupMenu:
TPopupMenu);
// Event procedure that will be call when menu item is selected.
procedure MenuEditClick(Sender: TObject);
// In TMainForm.OnCreate event of the program, assign the event on that will be form
IndicatorTitle menu items.
procedure TForm1.FormCreate(Sender: TObject);
begin
DBGridEhCenter.OnBuildIndicatorTitleMenu := BuildIndicatorTitleMenu;
end;
// Method Itself.
procedure TForm1.BuildIndicatorTitleMenu(Grid: TCustomDBGridEh; var PopupMenu:
TPopupMenu);
begin
// At first it calls the default method of menu building.
DBGridEhCenter.DefaultBuildIndicatorTitleMenu(Grid, PopupMenu);
// Then create new item.
if DBGridEhPreviewIndicatorMenuItem = nil then
DBGridEhPreviewIndicatorMenuItem := TDBGridEhMenuItem.Create(Screen);
DBGridEhPreviewIndicatorMenuItem.Caption := 'Preview';
DBGridEhPreviewIndicatorMenuItem.OnClick := MenuEditClick;
DBGridEhPreviewIndicatorMenuItem.Enabled := True;
DBGridEhPreviewIndicatorMenuItem.Grid := Grid;
// And add it at the end of the menu list.
PopupMenu.Items.Insert(PopupMenu.Items.IndexOf(DBGridEhSelectAllIndicatorMenuItem)+1,
DBGridEhPreviewIndicatorMenuItem);
end;
// The Handler of new menu item.
procedure TForm1.MenuEditClick(Sender: TObject);
begin
PrintDBGridEh1.DBGridEh := TDBGridEh(TDBGridEhMenuItem(Sender).Grid);
PrintDBGridEh1.SetSubstitutes(['%[Today]',DateToStr(Now)]);
PrintDBGridEh1.Preview;
end;
OnCellMouseClick: TGridEhCellMouseEvent;
type TGridEhCellMouseEvent = procedure (Grid: TCustomGridEh; Cell:
TGridCoord;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer) of object;
This event occurs on mouse clicking in any cell of the grid. Event has such parameters:
Grid; coordinates of the cell (Cell); Button, which was pressed on mouse (Button); Shift
state of keyboard (Shift) and coordinates of the clicked point inside cell (X, Y). In the
handler of event you can call the default handler DBGridEhCenter.DefaultCellMouseClick.
OnIndicatorTitleMouseDown: TGridEhCellMouseEvent;
type TGridEhCellMouseEvent = procedure (Grid: TCustomGridEh; Cell:
TGridCoord;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer) of object;
This event occurs when the mouse click on upper left cell of the grid occurs. In the
handler of event you can call default handler DBGridEhCenter.DefaultIndicatorTitleMouseDown.
OnLocateText: TLocateTextEventEh;
type TLocateTextEventEh = function (Sender: TObject;
const FieldName: string; const Text: String; Options:
TLocateTextOptionsEh; Direction: TLocateTextDirectionEh; Matching:
TLocateTextMatchingEh; TreeFindRange: TLocateTextTreeFindRangeEh):
Boolean of object;
This event occurs during increment or dialogue searching in the grid.
Other features.
Frozen zone.
Frozen zone is columns the left part of the grid that remains unchanged when the grid is
scrolled to the left or right direction. Unlike the fixed columns the frozen columns can receive
the edit focus. To specify the count of the un-scrolling columns you need to set FrozenCols
property.
Multiselect
TDBGridEh allows to select records, columns and rectangle areas for following operations
above the selected area.
To customize multiselecting you can use next properties:
dgMultiSelect in Options property - Specifies whether the multiselect is allowed.
dghClearSelection in OptionsEh property - Specifies whether the selection will be cleared
after user move to the next cell.
EditActions property - Specifies actions which user can execute above the selection
(Copy,Cut,Delete,Paste,SelectAll).
AllowedSelections - Specifies the types of selections that is allowed to do (Rows, Columns,
Rectangle area, All).
Selection property specifies a current multiselection state, selected records, columns or
rectangle area and it has properties and functions to access them.
TDBGridEh allows you to select records, columns and rectangle areas for further operations on
the selected area (for example, for copying to the clipboard). To enable multiple selection, set
the following properties:
dgMultiSelect in Options property - determines the possibility of multiple selection.
dghClearSelection in OptionsEh property - determines whether or not to clear deselecting
after the user has moved to another cell.
EditActions - defines the actions a user can perform with a selected area (Copy, Cut, Delete,
Paste, SelectAll).
AllowedSelections - determines the types of permitted areas that user can select (Rows,
Columns, Rectangle area, All).
Selection - defines the current status of multiple selection: the selected records, columns or a
rectangular area and includes features and functions to access them.
If user change the selected area, the OnSelectionChange event occurs.
To access the selected area, use the following properties of the grid:
SelectedRows: TBookmarkListEh It contains a list of selected records.
Selection: TDBGridEhSelection It contains information on the selected area and the list of
selected items.
Selection.SelectionType
Use Selection.SelectionType property to determine the type of the selected area. SelectionType
property is of enumeration type, and can contain one of the following
gstRecordBookmarks Records are Selected. Use the property SelectedRows or
Selection.Rows access to selected records.
gstRectangle Rectangular area is selected. Use Selection.Rect property to get the
border of the selected area.
gstColumns Columns are selected. Use Selection.Columns property to access the list
of selected columns
gstAll all grid is selected.
gstNon the grid has no multiple selection.
Selection.Rows
Property Selection.Rows (as did SelectedRows) has type TBookmarkListEh. Pointers to entries in
the list are stored as bookmarks DataSet (type TBookmark) and has the following properties
and methods:
Property Name
Property Type
Description
Count
Integer
Items[Index: Integer]
TUniBookmarkEh
CurrentRowSelected
Boolean
Selection.Rect
The Selection.Rect property is of TDBGridEhSelectionRect type. The property contains the
coordinates rectangel selected area. TDBGridEhSelectionRect Type gase the following
properties and methods:
Property Name
Property Type
Description
BottomRow
TUniBookmarkEh
LeftCol
Longint
TopRow
TUniBookmarkEh
RightCol
Longint
method
function DataCellSelected(DataCol: Longint; DataRow: TUniBookmarkEh): Boolean;
Returns information whether said cell within the selected area.
Selection. Columns
The Selection.Columns property is of TDBGridEhSelectionCols type. The property contains a list
of selected columns. TDBGridEhSelectionCols type have the following properties and methods:
Property Name
Property Type
Description
Count
Integer
Items[Index: Integer]
TColumnEh
Save and restore grid and columns layout to/from registry or ini file.
TDBGridEh have set of routines to save and restore grid and columns layout to/from registry or
Ini file:
RestoreColumnsLayout
Restore Columns Order , Width , SortMarker from registry.
RestoreColumnsLayoutIni
Restore Columns Order , Width , SortMarker from the ini file.
RestoreGridLayout
Restore Columns Order, Width, Visibility, SortMarker, Sortmarked index and/or row
height from registry.
RestoreGridLayoutIni
Restore Columns Order, Width, Visibility, SortMarker, Sortmarked index and/or row
height from the Ini file.
SaveColumnsLayout
Save Columns Order, Width, SortMarker in registry.
SaveColumnsLayoutIni
Save Columns Order, Width, SortMarker in the ini file.
SaveGridLayout
Save Columns Order, Width, Visibility, SortMarker, Sortmarked index and row height in
registry.
SaveGridLayoutIni
Save Columns Order, Width, Visibility, SortMarker, Sortmarked index and row height in
the Ini file.
TDBGridEh allows you to "black out" grid while loading data. This allows you to show the user
that a melon time DataSet loads data from the server. Grid
in the dark makes a smooth transition from the standard
picture to a darkened and back. Use StartLoadingStatus
FinishLoadingStatus methods to display the status of
downloading and reset it back respectively.You can call
methods that reload the data in DataSet between calls to these methods.
StartLoadingStatus and FinishLoadingStatus procedures have the following parameters:
procedure StartLoadingStatus(
const LoadingCaption : String = ''; // Text for Downloading staus
RenderDuration: Integer = -1 // Duration of the transition state
);
procedure FinishLoadingStatus(
RenderDuration: Integer = -1 // Duration of the transition state
);
The DataSet fields that require that data entry, property Field.Required is set to True. If you try
to move to a new record in DataSete (grid) did not complete one of the fields requires a value,
DataSet throw an exception, and will not leave the post until the field will not be filled or
recording all changes will be canceled.
The grid has the ability to highlight a cell in
which there are fields with mandatory values.
Set
TDBGridEh.ColumnDefValues.HighlightRequired
or TColumnEh.HighlightRequired to highlight
such cells. Grid will emphasize the red line pnuktirnoy required input values.
You can also write to the event TColumnEh.OnCheckDrawRequiredState to manage when you
have to draw a line indicator of mandatory data entry. In the event handler will set DrawState
parameter to True to display a line-indicator for the relevant records and fields.
Saving \ Restore position of the current row in the grid after the mass data changes in DataSet
When data changes in the DataSet using the methods DataSet.DisableControls DataSet.EnableControls current position in the grid may shift, causing discomfort to the user.
To avoid shifting position use methods
procedure TCustomDBGridEh.SaveVertPos(KeyFieldNames: String);
procedure TCustomDBGridEh.RestoreVertPos(KeyFieldNames: String);
to save the position of the grid before updating and restoring the position of the grid after the
update. The KeyFieldNames parameter must contain key field name (or a list of fields separated
by semicolons). The value of key fields will be used to restore the position when the DataSet
DataSet reopen during processing.
dgAlwaysShowEditor
Always display the text editor of the cell during the moving from cell to
line.
dgTitles
Show title row.
dgIndicator
Show Indicator column.
dgColumnResize
Allow resize and move columns.
dgColLines
Draw vertical dividing lines.
dgRowLines
Draw horizontal dividing lines.
dgRowSelect
Select the entire row of the grid instead of a single cell.
dgAlwaysShowSelection
Always draw a selection on the grid. When the grid does not have the
input focus, the area will be displayed in gray color.
dgConfirmDelete
Show confirmation window before removing the record on Ctrl + Delete.
dgCancelOnExit
Cancel Edit Mode using DataSet.Cancel if DataSet was set in append
mode, but user did not do any changes to the row.
dgMultiSelect
Allow select areas in the grid. For more information, see. In the
"Multiselect and working with the clipboard".
TDBGridEh.OptionsEh
property OptionsEh: TDBGridEhOption
The property has a set of type and can contain the following values.
dghFixed3D
Draw a border around the 3D cells fixed grid area.
dghFrozen3D
Draw a border around the 3D cells frozen area.
dghFooter3D
Draw a border around the 3D cells footer.
dghData3D
Draw 3D border around the cells containing the data records DataSet.
dghResizeWholeRightPart
In the AutoFitColWidths.
dghHighlightFocus
Highlight the current cell by color or thems style.
dghClearSelection
Clear selection mode MultiSelect when the Grid moves from cell to cell
using the keyboard.
dghFitRowHeightToText
When RowSizingAllowed = True, determines a change row heights to
customize the height of the mouse so that they always get the exact
number of lines of text without clipping.
dghAutoSortMarking
Change markers of sorting by clicking on the title which TitleButton =
True.
dghMultiSortMarking
Allows set markers sorting multiple columns at once, to set markers
sorting Run-Time, the user must press and hold down the Ctrl key.
dghEnterAsTab
Enter key behaves key Tab, that is, calls go to the next cell.
dghTraceColSizing
When dghColumnResize value is set then this value determines that it is
necessary to change the size of the column with the mouse while moving
the mouse. If the data value is not set, the size of the column will change
after you release the mouse button.
dghIncSearch
Allowed transition incremental search mode by Ctrl + F button
dghPreferIncSearch
If set dghIncSearch, the installation of this value determines the need
vlyuchaet incremental search mode immediately by pressing any letter
key numeric keypad. If this value is not set, the switch-over to
incremental search only after pressing a combination of Ctrl + F.
dghRowHighlight
Highlight the entire row of the grid. Unlike RowSelect, mode RowHighlight
notion of the current cell remains.
dghDblClickOptimizeColWidth
Optimize column width so that the column until all text cell by doubleclicking on the vertical dividing line header.
dghDialogFind
Allow search in the search grid through dialogue. Search dialog is opened
by pressing the Ctrl + F.
dghRecordMoving
Allow moving records by mouse.
dghShowRecNo
Show record number in the column indicator.
dghColumnResize
Allow the mouse to resize the column.
dghColumnMove
Allow the mouse to move the columns.
dghAutoFitRowHeight
Adjust the height of the row so that each cell until all text.
dghHotTrack
Highlight the cell on which the mouse cursor.
dghExtendVertLines
Is extended until the end of the vertical lines of the grid down.
TDBGridEh.DataRowCount
function TDBGridEh.DataRowCount: Integer;
Returns the number of rows of data excluding the header lines and footers.
Grid1: TDBGridEh;
end;
implementation
type
TDBGridEhCrack = class(TDBGridEh);
procedure TfrVertGrid.ToolButton1Click(Sender: TObject);
begin
TDBGridEhCrack(Grid1).ProptectedMethod;
end;
PrintDBGridEh1.SetSubstitutes(['%[Today]',DateToStr(Now)]);
PrintDBGridEh1.Preview;
Padding margins
Use TPrintDBGridEh.Page property to set the borders of the page margins. The
TPrintDBGridEh.Page property is of TPageParams type and has the following subproperties:
property
property
property
property
BottomMargin: Currency
LeftMargin: Currency
RightMargin: Currency
TopMargin: Currency
Low Indent.
Left Indent.
Right indent.
Top indent.
pghColored
Keep color printing. If the value is not contained in the property, the grid
will be printed in black and white.
pghRowAutoStretch
Stretch row height to accommodate all the text in the cell text wraps to a
new line.
pghFitingByColWidths
If the property is set pghFitGridToPageWidth, instead of the total scaling
when printing decreases the width of columns.
pghOptimalColWidths
Fit the column width to fit the contents of each cell within the same line
of text.
TPrintDBGridEh.PrintFontName
If you set this property, it will be used for printing the specified font property, instead of
the font specified in DBGridEh.
TPrintDBGridEh.Title
Title Grid. Title is printed on each page of the total cap for all the columns of the grid.
TPrintDBGridEh.OnBeforePrint
Event is called after printing a grid. In the event you can set a property of certain grid to
print it more "correct".
TPrintDBGridEh.OnAfterPrint
Event is called after printing a grid. In the event you can return a property of the grid
established in the event OnBeforePrint.
TPrintDBGridEh.OnPrinterSetupDialog
The event is called when the request for the opening of the press DIAL. If the event is
not set, it uses the method TPrintDBGridEh.PrinterSetupDialogPreview.
Component TDBVertGridEh is a visual component such like a vertical grid. The component is
used to display and edit a single DataSet record in a vertical orientation. The data is displayed in
two columns. The first column displays the names of
the fields and the second column show values of the
current record.
In the general case, the each row in the component
corresponds to a one field in the DataSet.
TDBVertGridEh and TDBGridEh components have a
common ancestor - TCustomDBAxisGridEh and have
similar functionality. TDBGridEh component can be
regarded as a table with a horizontal display of records
and TDBVertGridEh as vertical. In the current version
of EhLib TDBVertGridEh can display only one record on
the screen.
If you've worked with TDBGridEh component, then for understanding the properties of the
components TDBVertGridEh their properties can be compared as follows:
Properties of
TDBGridEh
Description
Properties of
TDBVertGridEh
Description
Columns
Rows
Options
Options
RowsDefValues
GridLineParams
GridLineParams
DataColParams
<There is no
analog>
TitleParams
LabelColParams
IndicatorParams
<There is no
analog>
Flat
Flat
DrawMemoText
You can use these methods to a property of, and access to the columns of the grid:
property DBGridEh.Rows: TDBVertGridRowsEh This is the main collection
lines
property DBGridEh.FieldRows[const FieldName: String]: TFieldRowEh Search row by a
field name. If the string, which TFieldRowEh.FieldName = FieldName not found, an
exception is thrown.
function FindFieldRow(const FieldName: String): TFieldRowEh; Search row by a field name. If the row, which TFieldRowEh.FieldName = FieldName not
found it returns Nil.
Other features of grid lines operate similar to how the columns operates in DBGridEh. They are
described in detail in the section "Types of columns and data types in DBGridEh.
vgsoByFieldRowCaptionAscEh
vgsoByFieldRowCaptionDescEh
Sort by FIeldRow
descending.
Title
Row[i].RowLabel.Caption
procedure SelectAllDataCells;
Select a rectangular area, so that it will get all the data cells.
Use TVertDBGridEh.Selection.SelectionType property to determine the current view selection.
Selection.SelectionType has TDBVertGridSelectionTypeEh type and can contain the following
values
vgstRowsEh
Allocate a full-line recording. To access the recording, use a
dedicated property Selection.Rows.
vgstRectangleEh Select a square region of the data. For access to the borders of the
area and use the properties of Selection.AnchorRowIndex
Selection.ShipRowIndex.
vgstAllEh
Select the entire grid.
vgstNonEh
Multiple selection is absent.
The property is of type TVertDBGridEh.Selection.Rows TFieldRowSelectionListEh and contains
the following properties and methods:
property Count: Integer
It contains the number of selected lines.
property Items[Index: Integer]: TFieldRowEh
Pointers on selected lines
procedure AddSelectedRow(ARow: TFieldRowEh);
Adds a new line type TFieldRowEh the list of selected lines.
procedure Clear;
Clears the list of selected lines
procedure RemoveSelectedRow(ARow: TFieldRowEh);
Deletes the line type from the list TFieldRowEh selected lines.
procedure SelectAll;
Selects all lines in the TVertDBGridEh.
When the user selects a rectangular area of data in the data grid on the allocation are stored in
the properties and Selection.AnchorRowIndex Selection.ShipRowIndex. When a rectangular
selection one cell always remains fixed and specifies anchor selection AnchorRowIndex. The
second cell specifies ShipRowIndex second selection border. If the user presses and drags the
mouse up or down, the value changes in ShipRowIndex property.
necessary to replace the parameters such as font, font, text alignment, the number of pictures
ImageList, etc., but drawing itself carries the internal code of the grid.
Type 2
Here is a list of events that you can use to customize the font attributes and color of the cell
before the data is printed. At the time of calling all of the following events DataSet will already
be on the record, the contents of which it is necessary to render, so you can access the field
values using the methods like TDataSet.FieldByName(..).Value. Do not change the properties of
the grid or columns inside those events. This may cause a program loops.
TDBVertGridEh.OnGetCellParams
Use this event to replace the font settings and the background color of the cell before
rendering. Event parameters are similar to the events for TDBGridEh.OnGetCellParams.
TFieldRowEh.OnGetCellParams
Use this event to replace the cell parameters a particular column before rendering. Parameters
are similar to the events soybtiya TColumnEh.OnGetCellParams.
TDBVertGridEh.OnAdvDrawDataCell TFieldRowEh.OnAdvDrawDataCell
Use this event to draw the data in the data cells of the grid. The event code set Processed
argument to True to specify that you have handled the process of drawing. If Processed leave
False, the grid method will render the contents of a cell using default method. You can, if
necessary, change the ARect and Params and cause Grid.DefaultDrawRowDataCell or leave
Processed able to False and do not induce Grid.DefaultDrawRowDataCell. To change the data
output to the screen, use the event parameters Params and Grid.Canvas if you draw a cell data
function on their own using GDI.
procedure DBVertGridEh_ExportToStreamAsXMLSpreadsheet(DBVertGridEh:
TCustomDBVertGridEh; Stream: TStream; Options: TExportAsXMLSpShOptionsEh;
ForWholeGrid: Boolean);
DBVertGridEh already uses this procedure to upload the data to the clipboard for pasting data
to MS Excel. When transferring data in this format, MS Excel receives information not only
about the content of the data but also about font, color, lines and the type of data.
Other features and events of the component
property Options: TDBVHGridOptions
Property type set. It may contain the following values.
dgvhEditing
The grid is allowed to open the text editor by clicking on the Enter or F2
Key.
dgvhAlwaysShowEditor
Always display the text editor of the cell during the transition from line to
line.
dgvhLabelCol
Display column with header fields.
dgvhRowResize
Permission is granted to change the row height using the mouse.
dgvhRowMove
Permission is granted to move the line with the mouse.
dgvhColLines
Draw a vertical dividing lines
dgvhRowLines
Draw a horizontal dividing line
dgvhTabs
Edit the Tab key in the grid. By Tab to move the cursor to the next line.
dgvhAlwaysShowSelection
Always draw a selection on the grid. When the grid does not have the
input focus area will be displayed gray color.
dgvhConfirmDelete
Show confirmation dialog before removing the recording Ctrl + Delete
dgvhCancelOnExit
Exit Edit Mode dataset methods DataSet.Cancel if grid included in append
mode recording, but did not do any changes to the rows.
A class for setting the global behavior of all the elements and
TDBVertGridEh TDBGridEh project
class TDBAxisGridEhCenter and global functions are declared in the DBAxisGridsEh.pas module
function SetDBAxisGridEhCenter(NewGridCenter: TDBAxisGridEhCenter):
TDBAxisGridEhCenter;
function DBAxisGridEhCenter: TDBAxisGridEhCenter;
They are intended for the implementation of a single point for the modification of certain
features in the DBGridEh and DBVerGridEh components. To change the behavior of all the grids
in the project, write your class and heir of TDBAxisGridEhCenter and registered it once
anywhere in the project by using the next function.
SetDBAxisGridEhCenter(TMyDBAxisGridEhCenter.Create).Free;
Occurs when EditButton is pressed in any editor cell component of any TDBGridEh or
TDBVertGridEh class. You can override this virtual procedure to write your actions when
you click on EditButton. To override the action clicking on the level of the individual grid
use the OnEditButtonDown and OnEditButtonClick event.
procedure EditButtonDefaultActionForImage(); virtual;
Occurs when EditButton is pressed in any editor cell component of any TDBGridEh or
TDBVertGridEh class for Blob field type which is the type of BlobType=ftGraphic.
procedure EditButtonDefaultActionText(); virtual;
Occurs when EditButton is pressed in any editor cell component of any class or
TDBGridEh TDBVertGridEh text field.
procedure FormSystemPopupMenuForColumn(); virtual;
Intended to form the Popup menu that opens when user clicks on when EditButton any
editor cell component of any TDBGridEh or TDBVertGridEh class. In the current
implementation, the procedure is called only for graphic Blob fields.
TDBDateTimeEditEh
Editing data of date or time type.
TDBComboBoxEh
Editing text data with an additional drop-down list to select the values.
TDBNumberEditEh
Editing the data of number type.
TDBLookupComboboxEh
Editing based on drop-down list with the record key values instead of the
displayed value.
TDBMemoEh
Editing multiline text data.
TDBImageEh
Editing graphic data.
TDBRadioGroupEh
Editing data mapping in a set of flags.
TDBRichEditEh
Editing text data with RichText format.
EhLib doesnt have not data-aware version of these controls because every control can work as
in data-aware mode and not in data-aware mode. The base class for every edit control is
TCustomDBEditEh. TCustomDBEditEh encapsulates the behavior that is common for all edit
controls for editing text and if it is required for editing a DataSets field by introducing methods
and properties that provide:
-
Basic text editing functions such as selecting text, modifying selected text, and case
conversions.
Properties for making it read-only or introducing a password character to hide the actual
value.
Validity checking using an edit mask.
Writing edited text to database field.
Showing one or several edit buttons (with variable glyphs: dropdown arrow, Ellipsis
arrow, up-down arrows, plus sign, minus sign or custom bitmap) at right part of edit
box,
Showing image from image list at the left part of the edit box.
Application can use Text (String type) and Value (Variant type) properties to get and set string
or variant values to controls. Text property is a text that you can see in control. Value property
hold value of variant type and can hold values of types depending of control type. It can hold
Null value or:
String type value for TDBEditEh and TDBComboBoxEh,
TDateTime, TDate, TTime, Double type value for TDBDateTimeEditEh,
All numeric types value for TDBNumberEditEh,
TDBLookupComboboxEh control hold value that depends on type of the field.
If control is connected to the field then the assignment data to the Text or Value properties
automatically write data to the field.
Every control has Flat and AlwaysShowBorder properties to control the border appearance.
published
property Name: String;
property Value: Variant;
In Run-Time collection items can be created dynamically by assigning values.
When reading a collection of values (DBEditEh1.DynProps ['Var1'].Value), if the item in the
collection named 'Var1' is present in the list, it returns the value of the variable. If the element name is
not present, it returns the value Unassigned.
When assigning values, the algorithm checks for the item in the collection.
DBEditEh1.DynProps ['Var1'].Value: = 'StrValue1';
If the item named 'Var1' isnt in the list, a new element is created in the collection and is assigned
with the specified value.
Property Type
Description
Action
TBasicAction
DefaultAction
Boolean
DropdownMenu
TPopupMenu
DropDownFormParams
TDropDownFormCallParamsEh
Enabled
Boolean
Glyph
TBitmap
Hint
String
Images
TEditButtonImagesEh
NumGlyphs
Integer
ShortCut
TShortCut
Style
TEditButtonStyleEh
Visible
Boolean
Width
Integer
ControlLabelLocation.Position = lpLeftTextBaselineEh
Use Images property to specify images that will be drawn in the drop-down list and image that
will be drawn on the left side of ComboBox. Index of drawing image is taken from ItemIndex
property.
TDBMemoEh control
The component is designed for editing multi-line text data.
The component can operate in Data-aware mode (connected to DataSet) and not in a simple
Data-aware mode.
Properties and methods of the component are similar to those of standard components
TDBMemo.
In addition, the component contains the following additional features:
- AlwaysShowBorder
- DynProps
- EditButtons
- EmptyDataInfo
- Flat
- HighlightRequired
- Images
- MRUList
- Tooltips
When you click on the Edit button, the default form opens DropDown for text editing.
TDBImageEh control
The component is intended for storing and displaying graphical information in a format
Bmp, Png or Gif.
The component can operate in Data-aware mode (connected to a DataSet) and not in a simple
Data-aware mode.
Properties and methods of the component are similar to those of standard components
TDBImage.
In addition, the component contains the following additional features:
- AlwaysShowBorder
- DynProps
- EditButtons
- EmptyDataInfo
- Flat
- HighlightRequired
- Images
- MRUList
- Tooltips
When you click on the Edit button, the default form opens DropDown image editing.
TDBRadioGroupEh control
When creating a Form through menu menu File-New-Other ...-Tab "EhLib Forms"-Element
"DropDown Form" a system call a library code that creates a new Form that is inherited from
CustomDropDownFormEh class.
Step 2 and 3 - Placing a components on the form and writing event handlers.
At Run-Time, working with a Form resembles working with a dialog box in a ShowModal mode.
However, the system closes the DropDown Form when the form loses it active state. You can
also close the form in the code indicating that the Form must be closed with a "Send the
selected value to the calling control" indication. In this case the event in the edit control would
be caused to store the selected value. You can also customize that the edit control assigns a
selected value to itself automatically.
The Library calls an TCustomDropDownFormEh.OnInitForm event before showing the Form. It is
necessary to initialize the Form before displaying and use the transferred data from the caller
control.
Here is an example of event handler for OnInitForm event:
procedure TDropDownMemoEdit1.CustomDropDownFormEhInitForm(
Sender: TCustomDropDownFormEh; DynParams: TDynVarsEh);
begin
if DynParams.Count >= 1 then
Memo1.Lines.Text := DynParams.Items[0].AsString;
sbOk.Enabled := not ReadOnly;
Memo1.ReadOnly := ReadOnly;
end;
In the above code the check is performed, whether any value was transferred from the Control
through the DynParams parameter. If it was transferred, the value is assigned to a Memo1.
DropDown Form may be in of ReadOnly. This property is assigned by the transmission control
depending of Control.Field.ReadOnly value. In the above code, we adjust components of the
form according to the state ReadOnly. Consider that a ReadOnly form will not return any value,
and will only be opened to view the data.
Closing the Form and transferring the selected values
Assign ModalResult property by mrOk to close the Form with the "Transfer selected value"
indication.
Below is a code sample that closes the Form:
procedure TDropDownMemoEdit.sbOkClick(Sender: TObject);
begin
ModalResult := mrOk;
Close;
end;
The program will close the Form and call OnReturnParams event to transfer the selected values
in the internal variables.
By default, the system offers to write the selected values in the DynVars array that is passed as
a parameter.
Below is an example of an OnReturnParams event handler:
procedure TDropDownMemoEdit1.CustomDropDownFormEhReturnParams(
Sender: TCustomDropDownFormEh; DynParams: TDynVarsEh);
begin
DynParams.Items[0].AsString := Memo1.Lines.Text;
end;
In our case, we write the text from a TMemo to the first item of a DynParams collection. The
collection will already contain an element, as we have already passed it in the Form using the
same collection (This part will be discussed later in the part of customizing the edit control).
TCustomDropDownFormEh.FormElements property
TCustomDropDownFormEh class has a property to define of displaying additional special
controls on the Form. Use FormElements property to specify which additional items have to be
placed on the Form in the Run-Time:
ddfeLeftGripEh SizeGrip control in the left corner. This element is used to change a
window size.
ddfeRightGripEh SizeGrip element in the right corner of the window.
ddfeCloseButtonEh Close button.
ddfeSizingBarEh The bar at the bottom of the window to change the height of the
window by mouse.
interface
initialization
RegisterClass(TMyDropDownForm1);
end.
There is another way to create a DropDown Form. Form is created before the first display and
lives up to the end of the life of the program.
To implement this method follow the next steps:
- Assign the DropDownFormParams.DropDownFormClassName property
- Register the class of the Form using RegisterClass (TMyDropDownForm1) code.
- Override the virtual class function TCustomDropDownFormEh.GetGlobalRef:
TCustomDropDownFormEh to create Form on the first call and assigns it to a global
variable.
Below is the sample of code that implements this functionality:
type
TDropDownMemoEdit3 = class(TCustomDropDownFormEh)
public
class function GetGlobalRef: TCustomDropDownFormEh; override;
end;
var
DropDownMemoEdit3: TDropDownMemoEdit3;
implementation
end.
Step 4.1 Assigning parameters from edit control the DropDown Form.
Property Type
Description
DropDownForm:
TCustomForm
DropDownFormClassName: String
Align:
TDropDownAlign
PassParams:
PassFieldNames:
String
AssignBackFieldNames:
String
FormWidth:
Integer
FormHeight:
Integer
SaveFormSize:
Boolean
(For DBVertGridEh)
TFieldRowEh.DropDownFormParams
TFieldRowEh.EditButtons[i].DropDownFormParams
TDBEditEh.EditButton.DropDownFormParams
TDBEditEh.EditButtons[i].DropDownFormParams
In EditButtons for TDBNumberEditEh, TDBDateTimeEditEh, TDBComboBoxEh,
TDBLookupComboBoxEh controls.
TMemTableEh component.
Two working mode of TMemTableEh component.
There are two working mode of TMemTableEh: stand-alone and with datadriver.
stand-alone mode.
In stand-alone mode TMemTableEh works as independent array of data. Before
working with such MemTable it is necessary to create an internal structure of record. For that it
is necessary to create external fields (TFields) or field definitions in TMemTableEh and call
CreateDataSet method (Or, at design-time, press Create DataSet button in Fields editor
window).
'with datadriver' mode.
The 'with datadriver' mode is activated when TMemTableEh.DataDriver property is assigned.
Internal array is created automatically on activation of MemTableEh. Structure of the fields is
delivered by DataDriver component.
ViewScroll
TMemTableEh supports special interface, allowing DBGridEh component to view all data
without moving active record. We will call such state as ViewScroll.
Master/detail relations.
Master/detail relation is a working mode of two datasets when all visible records of one dataset
(DetailDataSet) always correspond to one record of other dataset (MasterDataSet). In time of
moving in MasterDataSet the DetailDataSet will recreate or filters records so that they will
correspond to MasterDataSet record. The correspondence is adjusted using MasterFields and
KeyFields properties of DetailDataSet. DetailDataSet always show only the records, which
values of the field/fields defined by MasterFields property is equal to values of the fields
defined by MasterFields property of the current record of MasterDataSet.
TMemTableEh allows to create a master/detail relations on the client side "mdsOnSelfEh" (by
filtering record) or on DataProvider "mdsOnProviderEh" (by recreating list of records in
DetailDataSet when record in MasterDataset is changed).
To adjust TMemTableEh in the master/detail mode use next properties: MasterSource,
MasterFields, KeyFields, MasterDetailSide. When MasterDetailSide is
mdsOnSelfEh,
TMemTableEh will filter records by DetailFields fields using values of
MasterDataSet[MasterFields] fields. When MasterDetailSide is mdsOnProviderEh,
DetailDataSet will reopen itself, assigning parameters from MasterDataSet[MasterFields]. On
opening it will pass parameters to DataDriver. In the mdsOnProviderEh mode the DetailFields
are not used.
The third state of working "mdsOnSelfAfterProviderEh" is a combination of two preceding.
Upon first moving to record in MasterDataSet the DetailDataSet gets records from DataDriver,
sending him parameters with values, assigned from MasterSource[MasterFields] and add
received records in its internal array of record. Upon next moving on same record in
MasterDataSet the DetailDataSet will always only filter records locally.
Using indexes.
Indexes are used for speeding up searching. In particular it is used to building a tree-type
structure of records. Pattern of indexes is assigned in IndexDefs collection. TMemTableEh
creates indexes basing on the pattern when it making an internal array of records. It usually
happens when DataSet is activated).
Records sorting.
TMemTableEh has two methods of the sorting: Sorting with dynamic supporting of the changes,
when the added record is automatically move to the necessary position to support order of the
sorting.
And sorting without dynamic supporting of the changes.
1.
Use the SortOrder property to sort data with dynamic support of the changes. Separate
several fields by comma. Add DESC after fieldname to sort data in inverse sequence. Sorting
occurs at the TRecordsViewEh object, so physically the records doesnt move inside internal
array TRecordsListEh.
2.
Use SortByFields procedure to sort data without dynamic support of the changes. The
string that define sorting must have same format as for SortOrder property. Sorting occurs on
the level of TRecordsListEh, i.e. records are sorted physically in the internal array of data.
When you use EhlibMTE unit for automatic sorting in DBGridEh you can use global variable
SortInView of Boolean type to define the type of sorting that will be executed when DBGridEh
performs sorting after sorting markers in titles of grid are changed.
In stand-alone mode when MemTable is closing it does not delete internal array of records.
To close MemTable with simultaneous deleting of all records and structure, use DestroyTable
method.
Use EmptyTable method to delete all records from MemTable.
Cached updates.
TMemTableEh can work in operative or postpone updates. CachedUpdates property defines type
if updates. In operative mode of the updates, TMemTableEh sends changed record to c right after
application call TMemTableEh.Post method or append new record in TMemTableEh. In the
postpone mode the updates arent sent to postpone, but are accumulated in the special buffer.
Data are not transferred until the client application calls the ApplyUpdates method. To turn on
the postpone updates you need set CachedUpdates property to True.
ApplyUpdates have a single parameter MaxErrors. MaxErrors indicates the maximum number
of errors that the DataDriver should allow before prematurely stopping update operations. Set
MaxErrors to 1 to indicate that there is no limit to the number of errors. Set MaxErrors to 0 to
define that whole process of change will be rejected on first error. Records, which renovations
have come with errors, have an additional UpdateError property with type of TUpdateErrorEh.
To identify type of changing of record you need to use UpdateStatus method and StatusFilter
property:
UpdateStatus indicates a type of changing of current record in MemTable. It returns one of the
following values:
usUnmodified - Indicates that the current record havent been changed.
usModified - Indicates that the record was edited and changed.
usInserted - Indicates that the record was added.
usDeleted - Indicates that the record was removed.
StatusFilter defines filter for different types of records. StatusFilter is a set that can contains
any combination of the following values:
usUnmodified Unmodified records are visible in MemTable.
usModified - Modified records are visible in MemTable.
usInserted - Added records are visible in MemTable.
usDeleted Deleted record are visible in MemTable.
By default, StatusFilter have [usModified, usInserted, usUnmodified] value. So, deleted records
are hidden.
Method RevertRecord restores an old condition of the current record and values of fields. If
record was added in the program, it is deleted from the list. If record was changed then
UpdateStatus property is restored to usUnmodified value.
Method MergeChangeLog deletes a log of cached changes. All added or changed records get
usUnmodified status.
Method CancelUpdates cancels all changes and restores old state of records array.
Searching in TMemTableEh
You can search in TMemTableEh using following methods:
1. Locate
Locate moves the cursor to the first row matching a specified set of search criteria. In its
simplest form, you pass Locate the name of a column to search, a field value to match, and an
options flag specifying whether the search is case-insensitive or if it can use partial-key
matching. (Partial-key matching is when the criterion string need only be a prefix of the field
value.) For example, the following code moves the cursor to the first row in the CustTable
where the value in the Company column is "Professional Divers, Ltd.":
var
LocateSuccess: Boolean;
SearchOptions: TLocateOptions;
begin
SearchOptions := [loPartialKey];
LocateSuccess := CustTable.Locate('Company', 'Professional Divers, Ltd.',
SearchOptions);
end;
If Locate finds a match, the first record containing the match becomes the current record.
Locate returns True if it finds a matching record, False if it does not. If a search fails, the current
record does not change.
The real power of Locate comes into play when you want to search on multiple columns and
specify multiple values to search for. Search values are Variants, which means you can specify
different data types in your search criteria. To specify multiple columns in a search string,
separate individual items in the string with semicolons.
Because search values are Variants, if you pass multiple values, you must either pass a Variant
array as an argument (for example, the return values from the Lookup method), or you must
construct the Variant array in code using the VarArrayOf function. The following code illustrates
a search on multiple columns using multiple search values and partial-key matching:
with CustTable do
Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver','P']), loPartialKey);
Locate uses the fastest possible method to locate matching records. If the columns to search
are indexed and the index is compatible with the search options you specify, Locate uses the
index.
2. Lookup
Lookup searches for the first row that matches specified search criteria. If it finds a matching
row, it forces the recalculation of any calculated fields and lookup fields associated with the
dataset, then returns one or more fields from the matching row. Lookup does not move the
cursor to the matching row. It only returns values from it.
In its simplest form, you pass Lookup the name of field to search, the field value to match, and
the field or fields to return. For example, the following code looks for the first record in the
CustTable where the value of the Company field is "Professional Divers, Ltd.", and returns the
company name, a contact person, and a phone number for the company:
var
LookupResults: Variant;
begin
LookupResults := CustTable.Lookup('Company', 'Professional Divers,
Ltd.', 'Company;Contact; Phone');
end;
Lookup returns values for the specified fields from the first matching record it finds. Values are
returned as Variants. If more than one return value is requested, Lookup returns a Variant
array. If there are no matching records, Lookup returns a Null Variant.
The real power of Lookup comes into play when you want to search on multiple columns and
specify multiple values to search for. To specify strings containing multiple columns or result
fields, separate individual fields in the string items with semicolons.
Because search values are Variants, if you pass multiple values, you must either pass a Variant
array as an argument (for example, the return values from the Lookup method), or you must
construct the Variant array in code using the VarArrayOf function. The following code illustrates
a lookup search on multiple columns:
var
LookupResults: Variant;
begin
with CustTable do
LookupResults := Lookup('Company; City', VarArrayOf(['Sight Diver',
'Christiansted']),
'Company; Addr1; Addr2; State; Zip');
end;
Like Locate, Lookup uses the fastest possible method to locate matching records. If the columns
to search are indexed, Lookup uses the index.
3. FindRec
FindRec searches for the first row that matches specified search criteria and return record
number. FindRec have the same parameters as the Locate method.
When MemTableEh is in tree-view mode the Locate and FindRec methods search records in
expanded nodes. To search matches in all nodes you need to use MemTableEh.TreeList.Locate
method. This method also expand founded node, so it will be visible in dataset.
4. GotoRec
GotoRec moves the cursor to the row passed by the Rec parameter. GotoRec returns True if it
finds a record, False if it does not.
RecNo, Bookmark methods calls events about changing the record position that can bring about
big delays and repaint of the screen.
There are several ways in MemTableEh that allow to get values of the fields without activations
record position.
1. You can use DisableControls, EnableControls methods to deactivate events about
changes in DataSet. Disadvantage of this way is that EnableControls causes event about
changes DataSet, that will repaint visual component connected to DataSet.
2. You can use InstantReadEnter, InstantReadLeave methods to enter in InstantRead
mode.
InstantReadEnter enters in mode of viewing records and moves virtual position to the
record determined by the RowNum parameter. After that you can read but dont
change values of record. Each call of InstantReadEnter method, must correspond call
InstantReadLeave. InstantReadLeave leave a viewing records mode. In InstantRead
mode it is not allowed to change values of record. InstantReadEnter and
InstantReadLeave methods do not send events about changing position in DataSet.
3. You can use properties to access internal array of records of MemTableEh. Internal
objects allow to access values of record as to the array of data with index. Besides you
may addresses to all writing an internal array given disregarding local filter. For access
to internal structures of data you need to use following properties of TMemTableEh:
RecordsView: TRecordsViewEh
filtered list of records.
RecordsView.Rec[Index: Integer]: TMemoryRecordEh
access to certain record in filtered list of records.
RecordsView.Count: Integer
Count of records in the filtered list of records. In TreeView mode list have only visible
in expanded nodes.
RecordsView.MemTableData.RecordsList[Index: Integer]:
TMemoryRecordEh
access to certain record in the list of all records.
RecordsView.MemTableData.RecordsList.Count
Count of records in list of all records.
RecordsView.MemTableData.RecordsList[Index:
Integer].DataValues[const FieldNames: string; DataValueVersion:
TDataValueVersionEh]: Variant
access to certain value of field in record specified by Index.
FieldNames parameter specifies the name of the field or list of fields separated by a ";".
In case if FieldNames contains a list of fields, the return value will contain an array of
values.
DataValueVersion parameter defines the "version" or the type of value that should be
returned or assigned. In most cases, the value dvvValueEh can be used, which defines
the current active version of the field value.
In certain cases, the record can contain multiple values for the same field, but the active
value is always only one version, which can be get or put by passing dvvValueEh value
as a DataValueVersion parameter.
Multiple values appear when the record is edited or Post method is called for record
that was received from a server.
Version values can be associated with the kinds of record value buffers. Three buffers
can exist for one record:
1. Buffer of current values. This buffer is created when the record fetches data from a
server.
2. Buffer of editing values. This buffer is created at the moment when the record
changes it state to Editing. Buffer is destroyed when Post or Cancel method is called.
3. Buffer of old (server) record values. This buffer is created after the Post method is
called if the record obtained it initial values from the server. Ones it is written in the
buffer veluse doesnt been changed hereafter. This buffer is used to generate
UPDATE or DELETE SQL statements.
Unconditional versions - are versions that return values from a specific record buffer.
dvvCurValueEh A value from a buffer of current values.
dvvEditValueEh A value from a buffer of editing values.
dvvOldValueEh A value from a buffer of old (server) record values.
Conditional versions - these are versions that return the value of the specified buffer,
depending on the current state of the record:
dvvValueEh If the record is in the Editing and Inserting state, then value from the
buffer of editing values is returned, otherwise it takes values from the buffer of
current values.
dvvOldestValue If a buffer of old values exist then a value from this buffer is returned,
else if a buffer of a current values exist then a value from this buffer is returned,
otherwise, it returns a value from a buffer of editing values.
dvvRefreshValue If a buffer of old values exist then a value from this buffer is
returned, otherwise a value from a buffer of current values is returned.
Demo:
Loads data from a file FileName into the internal data array components TMemTableEh. In this
case, the old structure and the contents of the internal components of the array is removed.
Demo:
In addition, you can access the properties and methods for working with wood elements by the
property itself TMemTableEh.RecView. The property has the following properties for wood:
property NodeExpanded: Boolean
Node tree disclosed
property NodeHasChildren: Boolean
Node has a Child nodes
property NodeHasVisibleChildren: Boolean
The node has visible nodes Child
property NodeIndex: Integer
Index node in the node list Parent
property NodeItems[const Index: Integer]: TMemRecViewEh
Access to Child nodes
property NodeLevel: Integer
Level node in the tree
property NodeOwner: TMemoryTreeListEh
Tree nodes owner.
property NodeParent: TMemRecViewEh
Parent node for this node.
property NodesCount: Integer
Number of Child nodes
property NodeVisible: Boolean
Property Value Visible. The node can be visible or not visible in the tree. MemTableEh
automatically sets the status of the node, depending on the status of the filtering
entries. For all the records that do not fall into the filter assembly NodeVisible property
is set to False.
property VisibleNodeIndex: Integer
The index of the node in the list of visible nodes Parent node
property VisibleNodeItems[const Index: Integer]: TMemRecViewEh
Access to visible Child nodes
property VisibleNodesCount: Integer
The number of visible nodes Child
Below is a sample code that shows how to copy the contents and structure of the text
representation MemTableEh.
procedure TForm1.Button4Click(Sender: TObject);
The following code shows how to get a list of the top-level branches of which the current
branch MemTableEh.
procedure TForm1.Button5Click(Sender: TObject);
var
RecView: TMemRecViewEh;
begin
RecView := MemTableEh1.RecView;
while RecView <> MemTableEh1.RecordsView.MemoryTreeList.Root do
begin
DBMemoEh1.Lines.Add(
TDataDriverEh component.
TDataDriverEh is universal data provider for TMemTableEh and a handler of the changes
in TMemTableEh. TDataDriverEh is a simplest supplier of datas, it is a agent between
TMemTableEh and other DataSet, that can to work with the database. Although many DataSets
can be connected to DBGrid directly, avoiding TMemTableEh, ligament DBGridEh-DataSourceMemTableEh-DataDriverEh-DataSet is possible to use if you want to use advantages of
DBGridEh functioning in ligaments with MemTableEh such as ViewScroll mode, tree-type
viewing of data, using same data by the several MemTableEhs.
In the mode of the supplier, TDataDriverEh takes data from DataSet that assigned to
ProviderDataSet property, and copies them in TMemTableEh. Before getting first record,
MemTableEh requests structure of fields from TDataDriverEh and create internal array of
records. TDataDriverEh build structure of fields on basis of fields list of ProviderDataSet. As
required, TDataDriverEh takes values of the current record, writes their to a new record of
TMemTableEh and goes over to the next record in ProviderDataSet.
Furthermore, TDataDriverEh can refresh values of the existing MemTable record from
ProviderDataSet (TMemTableEh.RefreshRecord method). TDataDriverEh find record in
ProviderDataSet using fields value from KeyFields property and reread values of record in
MemTable record. When TDataDriverEh is used as handler of change
(TMemTableEh.ApplyUpdates method), it takes a changed record from TMemTableEh, using
characteristic KeyFields, finds its position in ProviderDataSet, updates a record in
ProviderDataSet, queries it again from ProviderDataSet and returns a record back in
TMemTableEh.
Events of TDataDriverEh allows to control data which are transferred between
TDataDriverEh and TMemTableEh , as well as transfer and process changes from any/to other
types source of data.
TDataDriverEh have next events:
OnBuildDataStruct - write this event to change a structure of fields created when
TMemTableEh requests structure of fields. You can call DafaultBuildDataStruct method to build
a structure by default.
OnProduceDataReader - write this event to return dataset-cursor to read data. You can call
DefaultProduceDataReader method to define dataset-cursor by default. By default datasetcursor will be a ProviderDataSet.
OnReadRecord - write this event to assign values of record of new record that delivered to
TMemTableEh, or indicate that no more data. You can call DefaultReadRecord method to assign
values by default. By default values of record will be assigned from dataset-cursor. If Eof
function of dataset-cursor is True then TDataDriverEh indicate that no more data.
OnAssignFieldValue - write this event to assign a value of each field of new record that is
delivered to TMemTableEh, or when record is refreshing. Use DataValueVersion to determine
the mode of assigning: dvvValueEh when need to assign value for a new record,
dvvRefreshValue - when need to assign value for existing record. You can call
DefaultAssignFieldValue to assign a value of the field by default.
OnRefreshRecord - write this event to assign fresh value of fields at the refreshment of
record from the server. You an call DefaultRefreshRecord to assign fresh values by default.
OnUpdateRecord - write this event to process updated records in TMemTableEh. Use
MemRec.UpdateStatus property to determine the type of changes: Updating, Deleting or
Inserting. You can call DefaultUpdateRecord to process updated record by default. By default
DataDriver conducts changes in ProviderDataSet.
OnUpdateError - write this event to respond certain actions when error is arising in time of
processing updates.
Following reaction is possible when error is arising:
ueaBreakAbortEh
ueaBreakRaiseEh
ueaCountinueEh
ueaRetryEh
ueaUpdated CountinueSkip
Ignore an error, set record status to Unchanged, continue a
performing the rest operations.
TSQLDataDriverEh component.
TSQLDataDriverEh is a universal DataDriver that can interact with server using SQL
commands. TSQLDataDriverEh have five objects of the TSQLCommandEh type: SelectCommand,
DeleteCommand, InsertCommand, UpdateCommand, GetrecCommand. Each object holds SQL
expressions and parameters to execute command to get table data, delete record, insert
record, update record and get one record. To execute commands TSQLDataDriverEh calls global
event - DefaultSQLDataDriverResolver.OnExecuteCommand. You should write this event to
execute SQL expressions on the server and, if need, return DataSet to read data. When
TSQLDataDriverEh is used as provider of data, it takes records from DataSet created in
DefaultSQLDataDriverResolver.OnExecuteCommand event and writes them in TMemTableEh.
On the measure of the requirement it takes given current record, writes them in TMemTableEh
and goes over to following record. When TSQLDataDriverEh is used as handler of changes, it
takes
a
changed
record
from
TMemTableEh,
and
call
DefaultSQLDataDriverResolver.OnExecuteCommand
event
sending
DeleteCommand,
InsertCommand or UpdateCommand as a parameter.
Using TSQLDataDriverEh it is possible change a type of the access to data. Suffice it to
rewrite global event - DefaultSQLDataDriverResolver.OnExecuteCommand.
TSQLDataDriverEh has a SpecParams property of TStrings type. You may use it to write the
special values, which you can use in the DefaultSQLDataDriverResolver.OnExecuteCommand
event. This event also is used by TServerSpecOperationsEh object when
DefaultSQLDataDriverResolver.ServerSpecOperations property is assigned. List of special values
depends of the type of TServerSpecOperationsEh object and values is filled similarly of
description in the "Characteristic TXXXDataDriverEh.SpecParams" section.
DefaultSQLDataDriverResolver.ServerSpecOperations property has a TServerSpecOperationsEh
type. This object is intended to process the special operations before or after ExecuteCommand
procedure is performed. TServerSpecOperationsEh is a base class for classes
TOracleSpecOperationsEh,
TMSSQLSpecOperationsEh,
TInterbaseSpecOperationsEh,
TInfromixSpecOperationsEh,
TDB2SpecOperationsEh,
TSybaseSpecOperationsEh
and
TMSAccessSpecOperationsEh. Each Of these objects can process a SpecParams property in
particular to get values of the autoincrement fields that is generated by the server. On the
name of the class it is possible to define a type of the server, for which class is intended.
For
full
functioning
of
TSQLDataDriverEh
it
is
necessary
to
write
DefaultSQLDataDriverResolver.OnExecuteCommand event to execute queries on the server and
assign DefaultSQLDataDriverResolver.ServerSpecOperations property by the object that
inherited from TServerSpecOperationsEh class. Assigning a ServerSpecOperations property
makes sense, if you execute operations of the insertion in tables that have autoincrement field
(or sequence objects).
The typical code to adjust working of TSQLDataDriverEh can be look as follows:
// Below code adjusts working of TSQLDataDriverEh components in the whole
Application to access
// InderBase server via BDE Engine
uses DataDriverEh, BDEDataDriverEh;
type
TMainForm = class(TMainForm)
Database1: TDatabase;
SQLDataDriverEh: TSQLDataDriverEh;
Property TXXXDataDriverEh.SpecParams.
Property SpecParams kept a list of parameters and values. TXXXDataDriverEh use them
when performing SQL expressions. Value of each parameter have to be wrote in the separate
line in the format PARAMETER_NAME =VALUE. Depending on the type of the server
(InterBase, Oracle, MSSQL, Informix) SpecParams can contain the following parameters.
On interaction with InterBase server:
GENERATOR - defines a name of the InterBase generator. DataDriver uses this
parameter to get current value of generator after the insertion of new record.
GENERATOR_FIELD - defines a name of the field, which will be assigned current value
of the generator after the insertion of new record.
AUTO_INCREMENT_FIELD - defines a name of the field, which DataDriver will set
AutoIncremet type. It is used on making a structure of the internal array of record.
On interaction with Oracle server:
SEQUENCE - will assign a name of the field Oracle sequences. DataDriver uses this
parameter for the reception of the current value of the sequence after the insertion of
new record.
SEQUENCE_FIELD - will assign a name of the field, which will be assigned current value
of the sequence after the insertion of new record.
AUTO_INCREMENT_FIELD - defines a name of the field, which DataDriver will set
AutoIncremet type. It is used on making a structure of the internal array of record.
On interaction with MSSQL server:
AUTO_INCREMENT_FIELD - defines a name of the field, which DataDriver will set
AutoIncremet type. It is used on making a structure of the internal array of record.
On interaction with Informix server:
AUTO_INCREMENT_FIELD - defines a name of the field, which DataDriver will set
AutoIncremet type. It is used on making a structure of the internal array of record.
TIBXConnectionProviderEh this will always be the server 'InterBase'). The type of server components
defines additional parameters for the database server. For example, on the type of server component
TXXXDataDriverEh defines the operating
mode with auto increment fields. In
TXXXConnectionProviderEh can specify different connection objects at the Design-Time and Run-Time,
thereby dividing the ways you can connect to the database during development and in the period of the
program. The component also allows you to specify access TADOConnectionProviderEh path to
MSAccess database in Design-Time line relative file location. A relative path starts from the location of
the form file, which has a component TADOConnectionProviderEh.
For example:
ADOConnectionProviderEh1.InlineConnection.ConnectionString = 'Provider =
Microsoft.Jet.OLEDB.4.0;
Data Source =% PROJECT_PATH% \ ..\ Data \ DBTest.mdb;
Persist Security Info = False '
When you open the form in Design-Time component replaces the macro "% PROJECT_PATH%" to the
path where the dfm form file is. This allows you to move the project to different computer and at
different location without changing the ways of access to the database file.
Demo:
Demo:
Demo:
Demo:
In the collection of the elements SQLDataDriverEh.MacroVars.Macros it is necessary to create macroelements and give them names according to the variables inscribed in the SQL command. At design-time
you can enter the values of macro variables, or leave them blank.
At run-time before the opening MemTableEh connected to SQLDataDriverEh you can set the value of
the macro variable:
if Conditions
then ADODataDriverEh1.MacroVars.Macros['%table_name%'] := table1
else ADODataDriverEh1.MacroVars.Macros['%table_name%'] := table2;
Demo:
library
DBGridEh.STFilter.Local = False
the expressions for filtering input from DBGridEh will not empty, the variable% Filter% 'has the
value' WHERE Filter Expression '.
SmuFilterWithANDPrecedingEh value specifies that in the event of non-null value to filter the
string value of this macro variable will generate the following rule 'AND Filter Expression'.
If smuFilterAsWhereClauseEh and smuFilterWithANDPrecedingEh SpecMacrosUsages absent in
the string value of the filter will be formed as is, without additional prior expression 'Filter
Expression'
Second macro variables SortOrderMacroName is the name that will be used when applying sorting
DBGridEh when preferences contain the following values:
DBGridEh.SortLocal = False
DBGridEh SQLDataDriverEh connected to the scheme - DBGridEh.DataSource.MemTableEh.
SQLDataDriverEh.
SQLDataDriverEh.SpecMacrosUsages contains value smuUseSortOrderMacroEh.
If smuUseSortOrderMacroEh not exist in SQLDataDriverEh.SpecMacrosUsages, sorting through change
SQL expression will be executed under the scheme described in EhLib users guide section - Sorting and
filtering data in DBGridEh.
Default FilterMacroName contain values '% Filter%'.
The formation of the variable SortOrderMacroName affect property values in SpecMacrosUsages:
SmuSortOrderAsOrderByClauseEh value specifies that in the event of non-null value to sort the
string value of this macro variable will generate the following rule 'ORDER BY 3, 7, ...'. In this
case SQLDataDriverEh.SelectSQL can be written as 'select from Country% SortOrder%'.
SmuSortOrderWithCommaPrecedingEh value specifies that in the event of non-null value to sort
the string value of this macro variable will generate the following rule ', 3, 7 ...'. In this case
SQLDataDriverEh.SelectSQL can be written as 'select from Country order by 5% SortOrder%'.
If smuSortOrderAsOrderByClauseEh smuSortOrderAsOrderByClauseEh and not in
SpecMacrosUsages, the string value of the filter will be created as is, without additional prior
expressions '3, 7, ... '. In the absence of information on the sorting will be set empty string value.
Demo:
library
<EhLib Dir\Demos\DataDriver.SpecMacros>
Type
Description
TADOConnection
Link to an external component ADOConnection.
TADOInlineConnectionEh Built-in component ADOConnection.
Boolean
Connected
InlineConnection.
WideString
ConnectionString
InlineConnection.
Boolean
UseAtDesignTime
InlineConnection.
Boolean
UseAtRunTime
InlineConnection.
TxactAttributes
Attributes
InlineConnection.
Integer
CommandTimeout
InlineConnection.
Integer
ConnectionTimeout
InlineConnection.
TConnectOption
ConnectOptions
InlineConnection.
TCursorLocation
CursorLocation
InlineConnection.
WideString
DefaultDatabase
InlineConnection.
TIsolationLevel
IsolationLevel
InlineConnection.
Boolean
KeepConnection
InlineConnection.
Boolean
InlineConnection.
LoginPrompt
InlineConnection.
TConnectMode
Mode
InlineConnection.
WideString
Provider
Path
string
ServerType
string
Type
Description
TResolverExecuteCommandEhEvent
TResolverGetBackUpdatedValuesEhEvent
TResolverGetServerSpecOperationsEh
TResolverUpdateRecordEhEvent
TNotifyEvent
TNotifyEvent
Demo project of using components of the consolidated analysis of the data, see the library
archive: <EhLib archive>\Demos\PivotGridEh.SimpleDemo\PivotGridEh.SimpleDemo.dpr
TPlannerWeekViewEh
TPlannerMonthViewEh
TPlannerVertDayslineViewEh
TPlannerVertHourslineViewEh
TPlannerHorzHourslineViewEh
TPlannerHorzDayslineViewEh
Another way of data loading through binding of DataSet and fields of DataSet.
For binding setup use sub-properties of TPlannerDataSourceEh.ItemSourceParams
property.
Set the TPlannerDataSourceEh.ItemSourceParams.DataSet property to DataSet which
should be used to load data from.
Fill
TPlannerDataSourceEh.ItemSourceParams.FieldsMap
collection
with
TItemSourceFieldsMapItemEh elements to set link between DataSet field and property
of TPlannerDataItemEh element-event.
or
procedure TDataSetTextExporterEh.ExportToStream(AStream: TStream);
The first method stores data in a file, the second one stores data in a stream. If set
AppendToFile to True, then data will be append to the file but not will be rewritten.
Main properties of TDataSetTextExporterEh component
Property Name
Property Type
Description
DataSet
TDataSet
Encoding
TExportImportEncodingEh
ValueSeparationStyle
TValueSeparationStyleEh
ValueDelimiter property.
ValueDelimiter
Char
QuoteChar
Char
IsExportFieldNames
Boolean
ExportValueAsDisplayText
Boolean
ValueExceedsSizeLimitAction
TValueExceedsSizeLimitActi
onEh
ExportRecordsCount
Integer
ExportFormats
TExportImportFormatsEh
FieldsMap
TFieldsMapCollectionEh
Specifies a collection of
TfieldsMapCollectionEh elements. Each
element of the collection defines the
parameters of a field in the export file. If
the FieldsMap collection is empty, then
all fields of DataSet will be exported.
Description
OnStartExport
TNotifyEvent
OnFinishExport
TNotifyEvent
OnExportTitle
TDataSetTextExporterExportLineEven
tEh
OnExportRecord
TDataSetTextExporterExportLineEven
tEh
OnTruncateTitleField
TTruncateTitleFieldEventEh
TTruncateDataFieldEventEh
OnGetFieldSize
TGetFieldSizeEventEh
OnFormatExportValue
TFormatTextExportValueEventEh
Component TDataSetTextImporterEh
Configure components properties in Design-Time.
Call the following method in Run-Time
procedure TDataSetTextImporterEh.ImportFromFile(AFileName: String);
or
procedure TDataSetTextImporterEh.ImportFromStream(AStream: TStream);
The upper screenshot the form is whown at Desig-Time. All components, except the
TCompoManEh, are hidden by a component editor CompoManEh1. The right side of the
screenshot you can see a window with a list of hidden components. The window opens when
you double-click on CompoManEh1. The window contains all the components form TForm2.
Right-click on the component from the list of Popup Menu Editor opens the selected
components.