Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomGridTableView.OnCanFocusRecord Event

In This Article

Allows you to prevent a record from being focused.

#Declaration

Delphi
property OnCanFocusRecord: TcxGridAllowRecordOperationEvent read; write;

#Remarks

Handle the OnCanFocusRecord event to prevent a specific record from being focused under specific conditions. The Sender parameter provides access to the grid View that raised the event, and the ARecord parameter identifies the record that is about to be focused. To focus the record, set the AAllow parameter to True. Otherwise, the record will not be focused and as a result, not selected also.

The following example prvents focus navigation to a record if its tvItemsSTATUS field has the 'Fixed' string value. The value displayed by the data item is determined by the indexed DisplayTexts property.

procedure TForm1.tvItemsCanFocusRecord(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; var AAllow: Boolean);
begin
  if ARecord.DisplayTexts[tvItemsSTATUS.Index] = 'Fixed' then
    AAllow := False;
end;
See Also