Search code examples
delphidevexpresstcxgrid

How to change TcxGridColumn's PopupWidth in runtime?


I'm using a TcxGridColumn which works as a Memo(blobEditKinf = bekMemo), the properties PopupHeight and PopupWidth on the RepositoryItem are fixed at 200/250, how can I change this to another value in runtime if I can't access those properties in code:

MyColumn.RepositoryItem.Properties

Solution

  • You can do this quite easily by doing a suitable cast of the column's Properties property. In the following, my BlobEdit column is for the Description memo field of a TClientDataSet:

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      [...]
      if cxGrid1DBTableView1Description.Properties is TcxBlobEditProperties then begin
        TcxBlobEditProperties(cxGrid1DBTableView1Description.Properties).PopUpWidth := 500;
        TcxBlobEditProperties(cxGrid1DBTableView1Description.Properties).PopUpHeight := 500;
      end;
    end;
    

    Many of the TcxGrid column editors have Properties types with type-specific sub-properties that you can access in a similar way to the above.