Filtering problem

I am not sure on how to describe my problem.

The only changes were the new versions of TMS Component pack from this year (all so far).
When filtering in an TAdvStringGrid I get different result rows than before.

Was there any change related to RealRowIndex?

With regards

   Wolfgang

Forgot to mention that previous version was 7.1.1.0 of TMS Component Pack before switching to 7.1.6.0 and all following

So I reinstalled 7.1.1.0 again and everything works fine.

To reduce the gap between 7.2.0.0 and 7.1.1.0 could you provide me a 7.1.5.0 ?

Than we could narrow down the possible error locations.

Do you have any information/steps how we could reproduce your problem?

For example the following code snippet gives an different row id with 7.1.0.0 than with newer versions for GetCheckBoxState

void __fastcall Tadvstrgrd_sort_filter_select::advstrgrdCheckBoxClick
                (TObject *Sender, int ACol, int ARow, bool State)
{
  TAdvStringGrid *clicked_grid   = dynamic_cast<TAdvStringGrid *>(Sender);
  bool            bln_state      = false;
  int             int_col_cnt    = 0;
  int             int_row_cnt    = 0;
  int             int_chkbox_col = 0;

  if ( clicked_grid->Name == "advstrgrd_filter_list" )
  {
    int_chkbox_col = 0;
  }
  else
  {
    int_chkbox_col = 1;
  }

  if ( ARow != 0 )
  {
    clicked_grid->GetCheckBoxState(int_chkbox_col, clicked_grid->RealRowIndex(ARow), bln_state);

I have retested this here with a default grid on the form and a TListBox with the code:



procedure TForm1.AdvStringGrid1CheckBoxClick(Sender: TObject; ACol,
  ARow: Integer; State: Boolean);
var
  st: boolean;
begin
  advstringgrid1.GetCheckBoxState(acol,advstringgrid1.RealRowIndex(arow),st);
  if st then
    listbox1.Items.Add(inttostr(acol)+':'+inttostr(arow)+':checked')
  else
    listbox1.Items.Add(inttostr(acol)+':'+inttostr(arow)+':unchecked');
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  fd: TFilterData;
begin
  advstringgrid1.RowCount := 50;
  advstringgrid1.RandomFill(false,3);
  advstringgrid1.AddCheckBoxColumn(2);
  advstringgrid1.Options := advstringgrid1.Options + [goEditing];
  advstringgrid1.FilterActive := false;
  fd := advstringgrid1.Filter.Add;
  fd.Condition := '2';
  fd.Column := 1;
  advstringgrid1.FilterActive := true;
end;

and this works as expected. GetCheckBoxState() returns the correct state of the checkbox.
This was tested here on the latest version v7.3.0.0 of TAdvStringGrid.

As long as there is now filter I agree, but as soon as the list is filtered with at least two "and" connected filter entries I get different row ids than before

It was retested here with:


procedure TForm5.AdvStringGrid1CheckBoxClick(Sender: TObject; ACol,
  ARow: Integer; State: Boolean);
var
  st: boolean;
begin
  advstringgrid1.GetCheckBoxState(acol,advstringgrid1.RealRowIndex(arow),st);
  if st then
    listbox1.Items.Add(inttostr(acol)+':'+inttostr(arow)+':checked')
  else
    listbox1.Items.Add(inttostr(acol)+':'+inttostr(arow)+':unchecked');
end;

procedure TForm5.FormCreate(Sender: TObject);
var
  fd: TFilterData;
begin
  advstringgrid1.RowCount := 50;
  advstringgrid1.RandomFill(false,3);
  advstringgrid1.AddCheckBoxColumn(2);
  advstringgrid1.Options := advstringgrid1.Options + [goEditing];
  advstringgrid1.FilterActive := false;
  fd := advstringgrid1.Filter.Add;
  fd.Condition := '2';
  fd.Column := 1;

  fd := advstringgrid1.Filter.Add;
  fd.Condition := '2';
  fd.Column := 3;
  fd.Operation := foAND;
  advstringgrid1.FilterActive := true;
end;

and this still works as expected.

I also did some testing and it seems to be more difficult than initially expected.

I integrated the TAdvStringGrid and all necessary functionalities in a frame years ago.

This frame works without any error till TMS Components 7.1.0.0.
With TMS Components 7.2.0.0 it gives wrong row ids.

This seems to come due to the usage of the frame within a form/frame.
I was able to use my frame with TMS Components 7.2.0.0 without any error.

So the change between 7.1.0.0 and 7.2.0.0 is related to the usage of my frame.

If you see a problem in our component, please provide some sample source app with which we can reproduce the problem here.

Today I start to build a small demo app to ether find my bug or prove yours :)

I´ll let you know ...

Just send you an example project.

We've answered your direct support email.

Thanks a lot.

I already rolled back to 7.1.0.0 and now awaiting the 25.02.2014.