Subject Re: IncSearch does not work in TIB_Grid
Author
Just found the source of the issue.

In the unit IB_Grid there is the method TIB_CustomGrid.DoIncSearchKeyPress.
In IBOv5.9 a part of that method is commented out and that was not commented out in v4.8.
When I uncommend it, incsearch works again.
Problem is, that I had to comment out the lines with FIncSearchLevel, as that does not exist any more.

I would like to know, why this part was commented out and if there are any issues when uncommenting it.

Jason, could you please take a look at it? I attach the source below, showing how it was in 4.8 and how it is in 5.9 before and after my correction.

Regards
Helmut

Here ist the method like it is in v4.8:
 procedure TIB_CustomGrid.DoIncSearchKeyPress( var Key: char );
var
  Match: boolean;
begin
  Match := false;
  if ( DataLink.Dataset is TIB_BDataset ) and
     Assigned( DataLink.Dataset.OrderingField ) then
  begin
    with DataLink.Dataset as TIB_BDataset do
    begin
      if FGridFields.IndexOf( OrderingField ) >= 0 then
        Self.Col := GridCol[ FGridFields.IndexOf( OrderingField ) ];
      case Key of
        #08: if Length(FIncSearchText) > 0 then
          System.Delete(FIncSearchText, Length(FIncSearchText), 1);
        #32..#255: if OrderingField.IsValidChar( Key ) then
          FIncSearchText := FIncSearchText + Key;
      end;
      if Key = #27 then
      begin
        if FIncSearchText <> EmptyStr then
        begin
          Match := IncSearchKey( Key, SearchKeyByKey, AllowTimeout,
                                                      SeekNearest );
          FIncSearchText := IncSearchKeyString;
          //Key := #0;
        end;
        FIncSearchState := false;
      end
      else
      if Prepared and
         (( Key in [ #08, #13 ] ) or
         OrderingField.IsValidChar( Key )) then
      begin
        if SearchKeyByKey and
           ( OrderingField.IsText or
            ( OrderingField.IsNumeric and
             ( OrderingRefinePos > 0 ))) then
        begin
          Inc( FIncSearchLevel );
          try
            Match := IncSearchKey( Key,
                                   SearchKeyByKey,
                                   AllowTimeout,
                                   SeekNearest );
          finally
            Dec( FIncSearchLevel );
          end;
          FIncSearchText := IncSearchKeyString;
          if Key = #13 then
            FIncSearchState := false;
          //Key := #0;
        end
        else
        if Key = #13 then
        begin
          Inc( FIncSearchLevel );
          try
            Match := IncSearchString( FIncSearchText, 1, SeekNearest );
          finally
            Dec( FIncSearchLevel );
          end;
          //Key := #0;
          FIncSearchState := false;
        end;
      end
      else
      begin
        MessageBeep( 0 );
        //Key := #0;
      end;
    end;
  end
  else
    MessageBeep( 0 );
  Key := #0;
  if FIncSearchText = '' then
    Match := false;
  if Assigned( FOnIncSearch ) then
    FOnIncSearch( Self, FIncSearchText, Match );
  if not FIncSearchState then
    FIncSearchText := EmptyStr;
end;

Here ist the method like it is in v5.9 (incsearch does not work):

procedure TIB_CustomGrid.DoIncSearchKeyPress( var Key: char );
var
  Match: boolean;
begin
  Match := false;
  if ( DataLink.Dataset is TIB_BDataset ) and
     Assigned( DataLink.Dataset.OrderingField1 ) then
  begin
    with DataLink.Dataset as TIB_BDataset do
    begin
      if FGridFields.IndexOf( OrderingField1 ) >= 0 then
        Self.Col := GridCol[ FGridFields.IndexOf( OrderingField1 ) ];
      case Key of
        #08: if iboLength(FIncSearchText) > 0 then
          iboDelete(FIncSearchText, iboLength(FIncSearchText), 1);
        #32..#255: if OrderingField1.IsValidChar( Key ) then
          FIncSearchText := FIncSearchText + Key;
      end;
      if Key = #27 then
      begin
        if FIncSearchText <> EmptyStr then
        begin
          Match := IncSearchKey( Key, SearchKeyByKey, AllowTimeout,
                                                      SeekNearest );
          FIncSearchText := IncSearchKeyString;
          //Key := #0;
        end;
        FIncSearchState := false;
      end
      else
      if Prepared and
         ((( Key = #08 ) or ( Key = #13 )) or
         OrderingField1.IsValidChar( Key )) then
      begin
{!!!!
        if SearchKeyByKey and
           ( OrderingField.IsText or
            ( OrderingField.IsNumeric and
             ( OrderingRefinePos > 0 ))) then
        begin
          Inc( FIncSearchLevel );
          try
            Match := IncSearchKey( Key,
                                   SearchKeyByKey,
                                   AllowTimeout,
                                   SeekNearest );
          finally
            Dec( FIncSearchLevel );
          end;
          FIncSearchText := IncSearchKeyString;
          if Key = #13 then
            FIncSearchState := false;
          //Key := #0;
        end
        else
        if Key = #13 then
        begin
          Inc( FIncSearchLevel );
          try
            Match := IncSearchString( FIncSearchText, 1, SeekNearest );
          finally
            Dec( FIncSearchLevel );
          end;
          //Key := #0;
          FIncSearchState := false;
        end;
}
      end
      else
      begin
        MessageBeep( 0 );
        //Key := #0;
      end;
    end;
  end
  else
    MessageBeep( 0 );
  Key := #0;
  if FIncSearchText = '' then
    Match := false;
  if Assigned( FOnIncSearch ) then
    FOnIncSearch( Self, FIncSearchText, Match );
  if not FIncSearchState then
    FIncSearchText := EmptyStr;
end;

And here ist the method like it is in v5.9 after my correction (incsearch does work):

 procedure TIB_CustomGrid.DoIncSearchKeyPress( var Key: char );
var
  Match: boolean;
begin
  Match := false;
  if ( DataLink.Dataset is TIB_BDataset ) and
     Assigned( DataLink.Dataset.OrderingField1 ) then
  begin
    with DataLink.Dataset as TIB_BDataset do
    begin
      if FGridFields.IndexOf( OrderingField1 ) >= 0 then
        Self.Col := GridCol[ FGridFields.IndexOf( OrderingField1 ) ];
      case Key of
        #08: if iboLength(FIncSearchText) > 0 then
          iboDelete(FIncSearchText, iboLength(FIncSearchText), 1);
        #32..#255: if OrderingField1.IsValidChar( Key ) then
          FIncSearchText := FIncSearchText + Key;
      end;
      if Key = #27 then
      begin
        if FIncSearchText <> EmptyStr then
        begin
          Match := IncSearchKey( Key, SearchKeyByKey, AllowTimeout,
                                                      SeekNearest );
          FIncSearchText := IncSearchKeyString;
          //Key := #0;
        end;
        FIncSearchState := false;
      end
      else
      if Prepared and
         ((( Key = #08 ) or ( Key = #13 )) or
         OrderingField1.IsValidChar( Key )) then
      begin
//{!!!!
        if SearchKeyByKey and
           ( OrderingField.IsText or
            ( OrderingField.IsNumeric and
             ( OrderingRefinePos > 0 ))) then
        begin
//          Inc( FIncSearchLevel );
          try
            Match := IncSearchKey( Key,
                                   SearchKeyByKey,
                                   AllowTimeout,
                                   SeekNearest );
          finally
//            Dec( FIncSearchLevel );
          end;
          FIncSearchText := IncSearchKeyString;
          if Key = #13 then
            FIncSearchState := false;
          //Key := #0;
        end
        else
        if Key = #13 then
        begin
//          Inc( FIncSearchLevel );
          try
            Match := IncSearchString( FIncSearchText, 1, SeekNearest );
          finally
//            Dec( FIncSearchLevel );
          end;
          //Key := #0;
          FIncSearchState := false;
        end;
//}
      end
      else
      begin
        MessageBeep( 0 );
        //Key := #0;
      end;
    end;
  end
  else
    MessageBeep( 0 );
  Key := #0;
  if FIncSearchText = '' then
    Match := false;
  if Assigned( FOnIncSearch ) then
    FOnIncSearch( Self, FIncSearchText, Match );
  if not FIncSearchState then
    FIncSearchText := EmptyStr;
end;