Skip to main content

TAdapter.Execute(TcxDataControllerConditionalFormattingProvider) Method

Invokes a “Conditional Formatting Rules Manager“ dialog for a specified conditional formatting provider.

Declaration

procedure Execute(AProvider: TcxDataControllerConditionalFormattingProvider); virtual; abstract;

Parameters

Name Type Description
AProvider TcxDataControllerConditionalFormattingProvider

A conditional formatting provider for container controls.

Remarks

Implement this procedure in a custom descendant of the TAdapter nested class and then call the RegisterRulesManagerDialog class procedure to replace the active form adapter.

The following code example contains the Execute procedure implementation in the standard dialog form adapter class that invokes the built-in “Conditional Formatting Rules Manager” dialog for container controls. You can base a custom Execute procedure implementation on this example. Replace a dialog form constructor with the constructor of a custom TfrmDataControllerConditionalFormattingRulesManagerDialog class descendant as described in comments below:

procedure TcxDataControllerConditionalFormattingRulesManagerDialogAdapter.Execute(AProvider: TcxDataControllerConditionalFormattingProvider)
var
  ADialog: TfrmDataControllerConditionalFormattingRulesManagerDialog;
  AIntf: IdxDialogOwner;
  AConditionalFormatting: TdxSpreadSheetCustomConditionalFormatting;
begin
  Supports(AProvider, IdxDialogOwner, AIntf);
  ADialog := TfrmDataControllerConditionalFormattingRulesManagerDialog.Create(AProvider); // Creates a "Conditional Formatting Rules Manager" dialog form. You can replace this call with your TfrmDataControllerConditionalFormattingRulesManagerDialog class descendant's constructor to replace the built-in dialog with a custom implementation
  try
    AConditionalFormatting := AProvider.ConditionalFormatting;
    ADialog.Initialize(AConditionalFormatting, AIntf.GetLookAndFeel); // Applies the target container control's look & feel settings to the dialog and populates it with rules from the control's conditional formatting provider.
    if ADialog.ShowModal = mrOK then
      ADialog.Helper.ApplyChanges; // Applies changes made to the rules only if a click on the OK button closes the dialog.
  finally
    ADialog.Free; // Releases the dialog form.
  end;
end;
See Also