DbAltGrid

In the demo program columns are arranged in a few lines. How is this done?

Column lines are called bands. To move a column, press the left mouse button on the column header and drag it with the mouse to its new location. If you move a header about one line below and drop it, a new line (band) will appear within rows and the column header will jump onto it. To change width or vertical size of a column cells, drag the right or bottom border of the column header. To change height of a band, drag the appropriate grip to the left of the active record.

There are a number of properties that control whether resizing and moving of columns is allowed. The dgColumnResize member of the Options set property controls width resizing and horizontal moving along the band the column placed on, the same way as for the standard DBGrid. The dagColumnAltResize member of the AltOptions set property controls vertical size resizing and vertical moving to another band. The dagBandResize member of AltOptions controls band height resizing.

At design time, you can change layout in a grid with persistent columns, i.e. created in the Columns Editor. You cannot reorder columns in a grid containing dynamic columns at design time, since there is nothing persistent to record the altered column order. Band heights are persistent, though. At runtime, the user can rearrange dynamic columns.

You can drag a child column within its parent column area only. To drag a parent column, shrink it and then move it as a whole.

How to add lookup list to a column?

There is no dedicated template components for simple pick list and lookup fields. TDbAltGrid uses the same means as the standard TDBGrid wich comes with Delphi. To find out how to enable support for lookup fields, see topic in the Delphi help: Contents / Developing Database Applications / Using DataControls / Defining a lookup list column.

Also, there are TdagPickGrid wich is alike multi-column pick list, and TdagLookupList wich provides lookup capabilities for regular fields.

I cannot find the Band and Size properties of a column in the Object Inspector.

Position of a column depends on many conditions, including positions and sizes of other columns and the order of columns. Please note, the Band and Size properties in the column class are public, not published, and they are not visible in the Object Inspector. At design time, the developer can change layout only by means of rearranging column headers visually with the mouse. At runtime, those properties are accessible in code, but since the placement algorithm is complicated, there is no easy way to set up certain layout by code.

Do I need to have persistent fields defined to use the collapsed/expanded parent column feature in DbAltGrid?

Persistent fields are not necessary. If the ParentField properties are set correctly in your field objects then columns follow that hierarchy automatically. In other case you can set for any column the ParentName property, even if the parent column is not assigned to a field.

What is the easiest way to replace a standard DBGrid with a DbAltGrid in my project?

Create a backup copy of your project.

Place a TdagBackup component on the same form the original TDBGrid resides on and set its Grid property to that grid. Right-click the TdagBackup and select Convert from the popup menu to turn the TDBGrid into a TDbAltGrid component. After you have done that, you can delete the TdagBackup component from the form, if it is no more needed. Switch to the Code Editor. Select Search | Replace in the main menu or press Ctrl+R to display the Replace Text dialog box. Replace all the occurrences of "TDBGrid" in the unit with "TDbAltGrid".

When I scroll an ADO dataset the alternate row colors are incorrect.

Does DbAltGrid support sorting, like the grid in Microsoft Outlook does?

In Microsoft Outlook you can see a kind of ListView. It holds strings itself internally like TStringGrid and TListView do, so you have all the strings in memory.

TDbAltGrid is a user interface component, not data-manipulating nor data-storage one. It is, like TDBGrid, a so-called data-aware component and is designed to display and edit records fetched from the underlaying dataset. The only advantage over TDBGrid is the ability to draw sort marks in header. TDbAltGrid can display an appropriate sort mark in the title cell for the field the dataset is sorted against and sorting options for other fields. In order to sort records, the grid would have to cache all data in memory locally and might consume unexpected amount of system resources and degrade performance. Since the underlying dataset can do all sorting stuff more effectively, you have to perform sorting using its methods.

Lines between columns are not visible in the title part of the grid.

That is not a bug, but anti-piracy protection in the trial version. Painting in the registered version is correct. Project created with the trial version may be completed with the registered version.