Filtering, sorting & resizing FIXED columns in TAdvStringGrid

Hello. I have set up a TAdvStringGrid like so:

grdData.FixedCols := 3;
grdData.RowCount := 3;
grdData.InsertRow(1);

grdData.FilterEdit.Row := 1;
grdData.FilterEdit.Enabled := true;
grdData.FilterEdit.CaseSensitive := false;

grdData.FilterDropDownAuto := true;
grdData.FilterDropDownCheck := true;
grdData.FilterDropDownColumns := fdAll;  // Allow filtering on FIXED cols
grdData.Options := grdData.Options - [goRowSelect] + [goColSizing, goColMoving];

This is what the grid looks like at runtime with some data in it:
image

There are some changes to the default behaviour that we would like to achieve:

  1. The1st column (checkbox) is ReadOnly/disabled. How can I make this column editable? I have a workaround with this code in the OnCellClick event:
   if (ACol = COL_CHECKBOX) and (ARow > 1) then
   begin
      grdData.GetCheckBoxState(COL_CHECKBOX, ARow, blnCheckbox);
      grdData.SetCheckBoxState(COL_CHECKBOX, ARow, not blnCheckbox);
   end;

but the column still looks disabled and will confuse our users.

  1. The fixed columns are not movable which is what we want, however the fixed columns are not resizable. Is this achievable?

  2. I am unable to sort or filter on fixed columns. We would like the fixed columns to behave like the others in this regard.
    According to the Developer’s Guide, setting FilterDropDownColumns to fdAll should allow the user to filter on a fixed column but it seems to make no difference in my app.

  3. A "nice to have" would be to have the cell background colour of fixed cells be white like 'normal' cells.

Regards and thanks in advance

  1. grid.ControlLook.NoDisabledCHeckRadioLook = true
  2. grid.MouseActions.SizeFixedCols = true
  3. grid.SortSettings.FixedCols = true
  4. grid.Look = glSoft / grid.FixedColor = clWhite

Awesome thanks Bruno!

One last question. How can I enable filtering on FIXED columns? This is what my grid looks like now:
image
Note the filter edit row. There are no filter edit boxes for the fixed columns.

This is my grid code:

   grdData.FilterEdit.Row := 1;
   grdData.FilterEdit.Enabled := true;
   grdData.FilterEdit.CaseSensitive := false;

   grdData.FilterDropDownAuto := true;
   grdData.FilterDropDownCheck := true;
   grdData.Options := grdData.Options - [goRowSelect] + [goColSizing, goColMoving];

   grdData.ControlLook.NoDisabledCheckRadioLook := true;
   grdData.MouseActions.SizeFixedCol := true;
   grdData.SortSettings.FixedCols := true;
   grdData.Look := glSoft;
   grdData.FixedColor := clWhite;
   grdData.FixedFont.Style := [];

Regards

Sorry Bruno. Another question if I may :slight_smile:
It appears my column font code has no effect on FIXED columns. Note in the screenshot above the header font is not bold and the 'Account' data should be underlined and Blue like the Balance and Owing columns. This is my code:

grdData.Columns[1].Header           := 'Account';
grdData.Columns[1].HeaderFont.Style := [fsBold];
grdData.Columns[1].Font.Style := [fsUnderline];
grdData.Columns[1].Font.Color := clBlue;

This works for non-fixed columns but not for fixed columns.
I have tried the FixedFont property, but that affects both Header and data cells. I guess I'm looking for a separate FixedHeaderFont property.

Regards

Set grid.FilterEdit.Columns = fdAll

Use grid.OnGetCellColor event and change the AFont parameter

Thanks Bruno!