Importing TDBGrid
- 3 minutes to read
This topic describes the properties imported from the standard Delphi TDBGrid to ExpressQuantumGrid. See the Converting to ExpressQuantumGrid document which describes working with the Import dialog and gives general pointers on importing third-party grid controls to the native format of EQGrid.
The converter imports a source TDBGrid into a new Table View represented by the target TcxGridDBTableView class.
The following grid View elements are imported from a TDBGrid control by the Import tool:
the DataSource property
columns and their attributes such as column width, caption, alignment, and visibility status
The type of a column being created is based upon TColumn (a TDBGrid column) properties according to the following table. The column type is assigned via the PropertiesClass property.
The following table describes the column types assigned based on combinations of TColumn properties:
TColumn properties | Column type assigned to a corresponding TcxGrid column |
---|---|
ButtonStyle = cbsAuto AND Field.FieldKind = fkLookup | A lookup combo box editor (TcxLookupComboBoxProperties). |
ButtonStyle = cbsAuto AND Field.FieldKind <> fkLookup AND PickList.Count > 0 | A combo box editor (TcxComboBoxProperties). |
ButtonStyle = cbsAuto AND Field.FieldKind <> fkLookup AND PickList.Count = 0 | A text editor (TcxTextEditProperties). |
ButtonStyle = cbsEllipsis | A button editor (TcxButtonEditProperties). |
ButtonStyle = cbsNone AND (ReadOnly = True OR Alignment <> taLeftJustify) | A text editor (TcxTextEditProperties). |
If your TColumn does not meet any of the conditions listed in this table, then the new column’s type will be exclusively determined by the field type. This is discussed in the FieldName topic of this help system.
- grid options
The next table describes the TDBGrid options imported to ExpressQuantumGrid. The second column specifies the properties of an EQGrid control which are set according to the flags included in the TDBGrid.Options property (unless otherwise indicated, an EQGrid property is set to True or False if a corresponding TDBGrid flag is enabled or disabled, respectively).
Flags enabled in the TDBGrid.Options property | The corresponding EQGrid property |
---|---|
dgAlwaysShowEditor | The View’s OptionsBehavior.AlwaysShowEditor property. |
dgAlwaysShowSelection | The View’s OptionsSelection.HideSelection property. This property is set to False, if the flag is enabled. Otherwise, it is set to True. |
dgCancelOnExit | The View’s OptionsData.CancelOnExit property. |
dgColumnResize | The View’s OptionsCustomize.ColumnHorzSizing property. |
dgColLines, dgRowLines | The View’s OptionsView.GridLines property. It is set to glNone, glHorizontal, glVertical or glBoth based on the flag combination. |
dgConfirmDelete | The View’s OptionsData.DeletingConfirmation property. |
dgEditing | The View’s OptionsData.Editing property. |
dgIndicator | The View’s OptionsView.Indicator property. |
dgMultiSelect | The View’s OptionsSelection.MultiSelect property. |
dgRowSelect | The View’s OptionsSelection.CellSelect property. This property is set to False, if the flag is enabled. Otherwise, it is set to True. |
dgTabs | The View’s OptionsBehavior.FocusCellOnTab property. |
dgTitles | The View’s OptionsView.Header property. |
- color and font settings
The look & feel of EQGrid is maintained by a number of style properties which identify the background and foreground colors and font attributes specific to particular grid elements. The converter imports the color and font settings of a TDBGrid control as style objects and applies them to the corresponding TcxGrid elements:
Color and font settings of TDBGrid | The corresponding EQGrid style property(s) |
---|---|
TDBGrid.Color and TDBGrid.Font | The View’s Styles.Content style. |
TDBGrid.FixedColor and TDBGrid.TitleFont | The View’s Styles.Header and Styles.Indicator styles. |
TColumn.Color and TColumn.Font | The column’s Styles.Content style. |
TColumn.Title.Color and TColumn.Title.Font | The column’s Styles.Header style. |