How to use Delphi in a "statement" in C ++ Builder

I am a novice programmer. I need to use the Delphi in operator in C ++ Builder XE as follows:

 if (dgColLines in DBGrid->Options) // include vertical lines in total (one per column) TotalColumnWidth = TotalColumnWidth + ColumnCount; 
 if (dgColLines **in** DBGrid->Options) 

How to do it in C ++ Builder?

Thanks in advance.

+6
source share
2 answers

Use the Contains method to check if a collection contains a specific element:

 if( DBGrid->Options.Contains(dgColLines) ) TotalColumnWidth = TotalColumnWidth + ColumnCount; 
+11
source

TDBGrid.Options looked at the TDBGrid.Options property in TDBGrid.Options , its type is TDBGridOptions , which is defined as:

 typedef System::Set<TDBGridOption, TDBGridOption::dgEditing, TDBGridOption::dgTitleHotTrack> TDBGridOptions; 

As you can see, C ++ Builder uses the System::Set<T, minEl, maxEl> to emulate Delphi set types.

All the functionality available with the built-in Delphi statements is displayed through methods Set . In particular, this question states that membership is being tested using Contains() .

+9
source

All Articles