Skip to main content

Example: TcxDBDataModeController.OnDetailIsCurrentQuery

The implementation of the TcxDBDataModeController.OnDetailIsCurrentQuery event is demonstrated in this example. In this event True is returned if the corresponding parameterized query should not be reopened. If the query should be reopened, False is returned.

If the query defines the required data (the query parameter specifies the same value as a detail key field value), it is not reopened.

function TForm1.DBTableView1DataControllerDataModeControllerDetailIsCurrentQuery(
  Sender: TcxDBDataModeController; ADataSet: TDataSet;
  const AMasterDetailKeyFieldNames: string;
  const AMasterDetailKeyValues: Variant): Boolean;
begin
  with (ADataSet as TQuery) do
    Result := ParamByName('CustNo').Value = AMasterDetailKeyValues;
end;