Skip to main content

TcxCustomGridTableView.OnCanFocusRecord Event

Allows you to prevent a record from being focused.

Declaration

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