Parent form with DBadvGrid with sorting,saving and more

I have a form with a DBadvGrid.
In the last 20 years,I created a form, serving as parent, with sorting up/down (multiple cols) saving and restoring col-names, sizes, headers, finding and filtering.
Most of the features I made are standard in the TMS grid.
However, with some items I have problems:

  • Sorting
    Its only working with pagemode=false; Can I do the sorting in the data-query?
    After the first sort, the NULL record stays on top
  • How to save the last sort choice (column(s) and up/down)?
  • Headers; what is the best way to save the headers?
  • Is there a search row, where you can enter data and there is a search in the selected(ordered) col?
  • How to search in the selected column(sorted) the first row starting with entered text?
  • How to filter and only showing rows the filter-text ?
  • How to insert a checkbox for row selection at col 1, moving all other colls to the right
  • What is AutoFormat and how do I use AutoSortForGrouping?
  • What do Fixedcolls and Full?
  • The header color does not change on sort (color and mirror color entered)
  • the Z to A glyph does not show
  1. see demo under Demo\DBAdvGrid\ADOSort for dataset based sorting
  2. If this concerns single column sort, the setting is under grid.SortSettings.Column / grid.SortSettings.Direction
  3. Get header text values via grid.Cells[x,0]: string and save these where you want
  4. grid.Find()
  5. Either perform dataset filtering (pagemode = true) or grid filter functions (pagemode = false)
  6. See demo Demo\DBAdvGrid\ADOSelection for a checkbox based row selection example
  7. AutoFormat will apply system locale settings for formatting floating point DB field values.
    AutoSortForGrouping applies to the grouping function and will perform a sort before creating the groups
  8. FixedCols sets the nr. of fixed columns. I'm not sure in what context you refer to Full here
  9. I'm not sure what you do, the grid itself has no built-in functionality to change a header color when doing sorting.
  10. Where you expect it and after what specific action?

Thank you for your extensive answer.
Wow, just learning the amazing posibilities of your grid!

  1. I use C:\Users\Public\Documents\tmssoftware\TMS VCL UI Pack Demos\DBAdvGrid\ADOSort
    There is no sorting action. There appears verry shallow arrows up and down.
  2. +3.Do you consider making a procedure for save/restore all settings (column order, size, header, filter, sort columns and direction)? After create you have the same screen as if you left it.
  3. found it, SearchFooter. Is it posible to add buttons and edit fields to the footer?
    I would like to add a filter checkbox and edit field and a button and editfield to alter the col header.
  4. clear, works fine.
  5. Found it: dbAdvGrid.Columns.insert(1). Only after insert the first col is overwritten and a empty col is added as last column. After removing the column the inserted title remeans, the data of the first coulmn reappears and the column on the right is removed.
procedure TForm1.bInsertColClick(Sender: TObject);
  Col: TDBGridColumnItem;
  if not cbPresent then
    Col := DBAdvGrid1.Columns.Insert(1);
    Col.Editor := edDataCheckBox;
    Col.Header := 'Kies';
    Col.Alignment := taCenter;
    Col.Width := 40;
  cbPresent := true;
procedure TForm1.bRemoveColClick(Sender: TObject);
  if cbPresent then
  cbPresent := false;
  1. sorry, Sortsettings.fixedcols and Sortsettings.full.
  2. I filled in Sortsettings, the bitmaps down-,up, indexup and indexdownglyph.
    Only the indexdownglyph appears on header click, second click the shallow up (default) appears
    down up and not my glyph.
  3. You implemented the Ctrl on mouse scroll changing the font size
    If I may suggest a (shift) key for scrolling fast scroll + shift: scroll by 10 lines or page

Thank you

  1. I see no issue with sorting by clicking the column header in the ADOSort demo

  2. This already covers many of this

  3. You can access the search footer panel with grid.SearchPanel and from there you can programmatically add additional controls to this panel.

  4. The grid always displays minimum 1 column. Inserting a column at index 1 adds an extra column after the first column.

  5. For single column sorting, you need to set grid.SortSettings.DownGlyph / grid.SortSettings.UpGlyph. I cannot see a problem with this.

  6. We added this on the feature request list.


Excuses dat ik het niet beter heb kunnen uitleggen.

Bijgaand enkel print-screens die het probleem hopelijk duidelijk maken.

Let u op de header die na het verwijderen van de kolom gelijk blijft maar wel de data van het volgnr weer laat zien.

Ik maak de checkbox doormiddel van de wijzig-button, rechtsonder

Kun u nog naar mijn vraag 8 kijken? (sorry, Sortsettings.fixedcols and Sortsettings.full.)

Dank voor uw moeite.

Met vriendelijke groet,

Jac van Megen


image002.jpg (11 KB)

When I use
to add a column
to remove the column, I see no header issue here.

Grid.FixedCols sets the nr. of fixed columns
Grid.SortSettings.Full is explained at page 19

That does not help.
I gave you the code for the create and delete I used, and printscreens of what happens here.

procedure TForm1.bInsertColClick(Sender: TObject);
  Col: TDBGridColumnItem;
    Col := DBAdvGrid1.Columns.Insert(1);
    Col.Editor := edDataCheckBox;
    Col.Header := 'Kies';
    Col.Alignment := taCenter;
    Col.Width := 40;
procedure TForm1.bRemoveColClick(Sender: TObject);

1.Can you tell me what I'm doing wrong?
2.Why stay de empty/NULL rows on top after sort?
3.Why does the blue arrow down appear (sort A-Z) but the arrow up (set in the properties) not? (Sort Z-A)

I could not run your app, it has references to databases not available here.
If you create code to reproduce, please use a TClientDataSet to make it really usable everywhere. (48.1 KB) Sorry, I hear you.
Hope this will help. Thanks

Did you get my example running?

I see you use the grid with PageMode = false.

In this condition, change your code to:

procedure TForm1.bMaakClick(Sender: TObject);
  Col: TDBGridColumnItem;

  if not Kiesveld then
     DBAdvGrid1.ColWidths[1] :=40;
     DBAdvGrid1.Cells[1,0] := 'Kies';
  Kiesveld := true;

procedure TForm1.bVerwijderClick(Sender: TObject);
  if Kiesveld then
  Kiesveld := false;

Yes, that works.
Thank you.

Remains 1 thing,
From the glyphs I load in IndexDownGlyph (see reply of 14 feb) and Up, only the down glyph is shown.
(not the up).
After reopening the form and preforming StringToColumnStates none of the glyphs is shown.

This happens when fixedcolls = 0 and col(0) is suppressed.
Please also look into my glyph problem, see above
you can use.
image (48.1 KB)

I hope you have the time to look into my questions.(above)
I have a suggestion to; when the properties of a row are extended with an ID, this field can be filled with - if pressent - the autoincfield of the record and so creating a possibility to acces the table data of the selected row

One more thing (I really need your help) is when you enter a unique search item which only is on the last line, you have to move yourself to that position, and when you press the up and down button the screens shifts out to the top.

Hi, Can you tell me if you looked at my examples?

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.

Sort glyphs are drawn as transparent bitmaps with the transparency color set by the left bottom pixel.
Your up glyph uses the arrow color as left bottom pixel, hence it is drawn transparent.

We improved the scrolling behavior when a search footer is used.
The next update will have these improvements.