0

I am using a TAdvMemo/TScrMemo in a form in C++ Builer 10.3. I am simply tring to implement the search/findtext method of the TAdvMemo/TScrMemo. But, I am getting the following error :

[bcc32 error] Unit2.cpp (159): E2285 No match found for 'TScrCustomMemo :: FindTextInMemo (UnicodeString, TFindOptionEx)'

I have a TAdvMemo/TScrMemo (Scripter), TButton, TEdit (for search)

void __fastcall TForm2::BtnSearchClick(TObject *Sender)
{
    String FSearch = EdtSearch->Text;
    Scripter->FindTextInMemo(FSearch,frDown);
}

What am I doing wrong here?

Function signatures:

int __fastcall FindTextInMemo(System::UnicodeString SearchStr, Vcl::Dialogs::TFindOptions Options)/* overload */;
int __fastcall FindTextInMemo(System::UnicodeString SearchStr, TFindOptionsEx Options)/* overload */;

ANSWER:
Got it compile without error with the following code:

void __fastcall TForm2::BtnSearchClick(TObject *Sender)
{
    String FSearch = EdtSearch->Text;
    TFindOptions fn;
    fn = TFindOptions() << frDown;
    Scripter->FindTextInMemo(FSearch,fn);
}

Looks like the frDown component is from a Delphi set and I have to do like above to use it in C++.

Delphi Coder
  • 1,723
  • 1
  • 14
  • 25
inapathtolearn
  • 65
  • 2
  • 10
  • I don't have TMS installed. What does the actual signature of `FindTextInMemo()` look like? Maybe there are more/different parameters present that you are not passing in? – Remy Lebeau Oct 30 '19 at 18:40
  • These are the two signatures available in the ScrMemo.hpp file: – inapathtolearn Oct 31 '19 at 09:56
  • int __fastcall FindTextInMemo(System::UnicodeString SearchStr, Vcl::Dialogs::TFindOptions Options)/* overload */; int __fastcall FindTextInMemo(System::UnicodeString SearchStr, TFindOptionsEx Options)/* overload */; – inapathtolearn Oct 31 '19 at 09:57
  • You should have posted your update as an answer instead. But yes, that is the correct solution. Though, you don't need the local variables: `Scripter->FindTextInMemo(EdtSearch->Text, TFindOptions() << frDown);` – Remy Lebeau Oct 31 '19 at 23:55

0 Answers0