Skip to main content

TcxCustomGridTableView.OnCanFocusRecord Event

Occurs before focusing a grid record.

Declaration

property OnCanFocusRecord: TcxGridAllowRecordOperationEvent read; write;

Remarks

Use the OnCanFocusRecord event to control focusing of a record. The Sender parameter identifies the affected View and the ARecord parameter specifies the record 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 disables focusing of a record if its tvItemsSTATUS field has a value of ‘Fixed’ string. The value displayed by the 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