Mega Code Archive

 
Categories / Delphi / Examples
 

Search

Subject: Delphi: Bug in SEARCH.PAS I found a bug in the sample SEARCH.PAS (used for searching memo fields. ) It won't find the last word going forward or the first word going backward. For example, run the TEXTDEMO demo and type this is a test Go to the beginning and search for test. It won't find it. Go to the end and search for "this" and it won't find it. The solution that I found was to increment the "search count" variable by one. these lines used to read: line 107 SearchCount := BufLen - SelStart - Length(SearchString); line 115 SearchCount := SelStart; I just changed them to add one to the search count calculation: line 107 SearchCount := succ(BufLen - SelStart - Length(SearchString)); line 115 SearchCount := succ(SelStart); I'll report any other bugs I find. If anyone one else finds any, please post them. Thanks. --Pete Royston - dbrk81a@prodigy.com