Jump to content


Photo

SearchNext / SearchFirst


  • Please log in to reply
1 reply to this topic

#1 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 15 July 2007 - 05:39 PM

Hi Boki

It would be usefull if there was a SearchFirst function to find the first record that matched the search criteria based on the current sort order. SearcNext starts searching from the selected row, so the next record that matches the search criteria is not neccessarily the first record that matches the search criteria.

Instead of adding a SearchFirst (FindFirst?) function, you can achieve the same result by passing a "FromFirst" parameter to the SearchNext function.

CODE
function TNxCustomGrid.SearchNext(ColumnIndex: Integer; Value: WideString; FromFirst: Boolean = False): Boolean;

..........

begin
  Result := False;
  if RowCount = 0 then Exit;
//start new
  if FromFirst then
    Result := Roll(0, RowCount - 1)
  else
//end new
    Result := Roll(SelectedRow + 1, RowCount - 1) or Roll(0, SelectedRow);
end;


Regards,
Deon

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 15 July 2007 - 08:30 PM

Hello Deon,

I have add it, thank you, it is nice idea.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users