Skip to main content

TcxDBDataModeController.OnDetailIsCurrentQuery Event

Occurs when navigating through records of the detail data controller linked to a parameterized dataset.

Declaration

property OnDetailIsCurrentQuery: TcxDBDataModeControllerDetailIsCurrentQueryEvent read; write;

Remarks

This event is only used in rare cases. The TcxDBProviderDetailFilterAdapter and TcxADOProviderDetailFilterAdapter classes implement functions using the OnDetailIsCurrentQuery event for BDE and ADO queries respectively. If you use an ADO query, you just need to manually add the cxADOAdapters unit to the uses section of your form (for BDE queries this is not required).

The OnDetailIsCurrentQuery event is generated when navigating through records of the detail data controller linked to a parameterized dataset or when shifting from one detail controller to another at the same level.

The following image shows a fragment of the grid control with two details at level 1:

The OnDetailIsCurrentQuery event is generated when moving focus from one record to another within Detail 1 or Detail 2. If you navigate through records within one detail, you do not need to reopen the underlying query since it already selected the required data. But if you move focus from Detail 1 to Detail 2, you will need to reopen the query so that it selects new data.

If the query should be reopened, the OnDetailIsCurrentQuery event handler must return False, which indicates that a user has moved focus to another detail. Otherwise, True must be returned. The query is re-opened internally either by the ReopenSQL method of the TcxDBProviderDetailFilterAdapter or TcxADOProviderDetailFilterAdapter class or by the OnDetailFirst event handler.

Sender specifies the TcxDBDataModeController object, which belongs to the detail data controller displaying query data.

ADataSet specifies the parameterized query dataset.

AMasterDetailKeyFieldNames specifies the DetailKeyFieldNames property value of a detail data controller.

AMasterDetailKeyValues specifies a single value or an array of values for detail key fields identified by the AMasterDetailKeyFieldNames parameter.

The CustNo field in the image above establishes a master-detail relationship. In this instance, AMasterDetailKeyFieldNames is ‘CustNo’ for both details. When you navigate through records within Detail 1, the AMasterDetailKeyValues parameter specifies 3042. When moving focus to Detail 2 AMasterDetailKeyValues specifies 3051.

See the example of the OnDetailIsCurrentQuery event handler at the top of this topic.

See Also