0

I have a TAdvStringGrid with a filter

FilterDropDownAuto:= true;
FilterDropDownCheck:= true;

Looks like this:

grid header

If the filter is active, I need to notify an user somehow. For example column header, or entire column in different color etc.

How to decide if the filter is active or not? I tried to use GetColumnFilter event:

procedure TfrmDeliveries.grdDeliveriesGetColumnFilter(Sender: TObject;
  Column: Integer; Filter: TStrings);
begin
  ///
end;

But no matter the state of the filter, I don't see anything in the "Filter" variable, that could be used to decide if the filter is set, or not. If I trace what is happening, it always looks like this: local variables

The "FDefined" property looks promissing, but it is always empty. Nothing changes in the local variables at all...

I need to find some way to highlight the column, or the header if the filter is defined. Any help would be appreciated.

Thank you

j.kaspar
  • 751
  • 1
  • 11
  • 29
  • 1
    The `Filters` parameter is a `TStrings`, so the content would be in it's `Strings` property (which is the default and therefore can be omitted). So to access the entries, you would use an integer index from `0` to `Filters.Count - 1`, and read the values with `Filters[i]` (or `Filters.Strings[i]`), where `i` is that integer index. – Ken White Mar 15 '16 at 01:19
  • @KenWhite I knew I am missing something simple :) Thank you! – j.kaspar Mar 15 '16 at 07:56
  • So, it will not be that simple. I see the content of the Filter.Strings, but 1. it does not make sense to me at all - it is a mayhem of some (not all) strings contained in a column, combined with "some" numbers etc. But I believe that it is me not understanding the mechanism of the filter... It is not important 2. I don't see any indication, that some of the filter conditions - the checkboxes, are used to actually filter the data... I am sorry, but that is my first time using filters in a grid, and I didn't find any relevant information on internet... – j.kaspar Mar 15 '16 at 18:35
  • Well, I certainly can't see it from here where I'm sitting. Did you try posting in the TMS forums? They're the ones that are most familiar with their controls, and you may find a question there already that will help. Their documentation for the TAdvStringGrid has a full section on filtering content as well as some advanced topics related to doing so. Have you checked that as well? The `Filters` are a `TStrings`, just as I said, and the content is where I told you it would be. I can't interpret that content for you, I'm afraid, but TMS certainly can. – Ken White Mar 15 '16 at 21:54
  • I understand... I will try the TMS forum. Thanks – j.kaspar Mar 16 '16 at 08:10

0 Answers0