Denis Ndoja
Denis Ndoja

Reputation: 45

How to edit TcxGrid properties by code in Delphi

What the program does
I have a function that dynamically generates a table and populates it. So...
What's the problem?
The problem is that i've tried looking for a way to edit a specific column properties by code since I can't (Obviously) use the normal properties Editor in delphi, but I've haven't had any success so far.

Here's what I've tried SO far:

for I := GridOrdiniMagazzinoPadreView1.ColumnCount - 1 downto 0 do
begin
  GridOrdiniMagazzinoPadreView1.Columns[I].Destroy;
end;
GridOrdiniMagazzinoPadreView1.DataController.CreateAllItems;

GridOrdiniMagazzinoPadreView1.Columns[0].PropertiesClassName := 'CheckBox';

It doesn't show the CheckBox, I know it shouldn't do anything since i didn't set the checked status and neither how to recognize the String to set it as checked or not checked. But i expected at least to see the checkBox.

Upvotes: 1

Views: 1603

Answers (1)

Fabrizio
Fabrizio

Reputation: 8053

You are setting the wrong classname, passing 'TcxCheckBoxProperties' will work:

GridOrdiniMagazzinoPadreView1.Columns[0].PropertiesClassName := 'TcxCheckBoxProperties';

Anyhow, I always prefer to set the PropertiesClass property, instead of the PropertiesClassName property:

uses
  cxCheckBox;

...

GridOrdiniMagazzinoPadreView1.Columns[0].PropertiesClass := TcxCheckBoxProperties;

Upvotes: 2

Related Questions