Home > Back-end >  C test function cannot compile
C test function cannot compile

Time:10-02

//in Delphi can compile
The function SoFindDialog (Options: TFindOptions) : string;
The begin
If frDown in options then begin
//down
End the else begin
//up
The end;
The end;

//in c + + Builder test function cannot compile
String RSoFindDialog (TFindOptions * Options)
{
If (frDown options) in {
//down
} else {
//up
}
}
//don't know if I write wrong there

CodePudding user response:

If (frDown in options)

C + +, there is no this kind of grammar,,,,

CodePudding user response:

 String RSoFindDialog (TFindOptions * Options) 
{
If (Options - & gt; The Contains (frDown))
{
//down
}
The else
{
//up
}
}

CodePudding user response:

Reply: ksrsoft

Hello c + + Builder 6 without this parameter... -> The Contains

CodePudding user response:

Reply: hi ksrsoft

Call cannot compile?
Void __fastcall TForm1: : FormClick (TObject * Sender)
{
RSoFindDialog (FindDialog1 - & gt; The Options);
}

CodePudding user response:

If (Options. The Contains (frDown))

CodePudding user response:

Reply: hi realbay

Call cannot compile?
Void __fastcall TForm1: : FormClick (TObject * Sender)
{
RSoFindDialog (FindDialog1 - & gt; The Options);
}

CodePudding user response:

Do you want to stick all code, others don't know what is frDown

CodePudding user response:

Reply: realbay

You are in Form1 add a control
FindDialog controls have FindDialog1 - & gt; The Options parameter frDown
FrDown parameter is///up/down to find the

CodePudding user response:

TFindOptions is a collection (Set), that is to say, TFindOptions is Sysdefs h, Set an example of the template class, if you want to know if an element is a member of the collection, you can use the Contains method:
The Options - & gt; The Contains (frDown);
Secondly, TFindDialog Options is an object, rather than a pointer, so in your RSoFindDialog to obtain when using a pointer:
RSoFindDialog (& amp; (FindDialog1 - & gt; The Options));

Best used reference in RSoFindDialog & amp; :
String RSoFindDialog (TFindOptions & amp; The Options)
{
If (Options. The Contains (frDown)
{
//down
}
The else
{
//up
}
}
  • Related