TcxCustomGridTableItem.OnGetPropertiesForEdit Event
Allows you to change the in-place editor and customize its settings when a user invokes it for a data cell in the table item.
Declaration
property OnGetPropertiesForEdit: TcxGridGetPropertiesEvent read; write;
Remarks
You can handle OnGetPropertiesForEdit
and OnGetProperties events to use multiple in-place editors in one table item. The OnGetProperties event allows you to use different in-place editors for different cells in a table item while the OnGetPropertiesForEdit
event allows you to change the active in-place editor and its settings when a user invokes it.
Note
Editor setting changes made in an OnGetPropertiesForEdit
event handler are in effect only when an in-place editor is used to edit a value. Properties, PropertiesClass, PropertiesClassName, and RepositoryItem properties as well as an OnGetProperties event handler define the base state of the selected in-place editor.
Event Occurence
The OnGetPropertiesForEdit
event occurs every time a user invokes an in-place editor in the table item, immediately before the table item creates an editor instance.
Tip
The OnGetPropertiesForEdit
event is useful when you need to display different in-place editors in active and inactive states.
Event Parameters
You can use Sender
and ARecord
parameters to identify the data cell whose in-place editor is about to be displayed. The AProperties
parameter allows you to use a preconfigured edit repository item to change the active in-place editor or its settings for the target cell.
Refer to the TcxGridGetPropertiesEvent procedural type description for detailed information on parameters accessible within OnGetPropertiesForEdit
and OnGetProperties event handlers.
Code Example: Switch Between Bar Code and Text Editors
The following code example handles the OnGetPropertiesForEdit
event and uses a preconfigured edit repository item to display a single-line text editor instead of a non-editable barcode editor when a user clicks it:
procedure TEditorsInPlaceDemoMainForm.cvBarCodeGetPropertiesForEdit(
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
var AProperties: TcxCustomEditProperties);
begin
inherited;
AProperties := cxEditRepository1TextItem1.Properties;
end;
Important Limitations
Do not perform the following operations within OnGetProperties and OnGetPropertiesForEdit
event handlers to avoid possible drawing errors and access violations:
- Do not change Properties, PropertiesClass, and PropertiesClassName property values.
- Do not change individual in-place editor settings accessible through the
AProperties
parameter as demonstrated in theOnGetPropertiesForEdit
event handler example.
Tip
To change the active in-place editor type or its settings within an OnGetPropertiesForEdit
event handler in a safe manner, assign the Properties property value of an edit repository item to the AProperties
parameter.