cxGrid应用笔记

1.获得当前列号

  //移动列的位置后,返回结果也改变.

    cxGridDBTableView1.Controller.FocusedColumnIndex;

  cxGridDBTableView1.Controller.FocusedItemIndex;


2.获得当前行号

  //过滤、排序操作会改变返回的结果。
  cxGridDBTableView1.Controller.FocusedRowIndex;

  cxGridDBTableView1.Controller.FocusedRecordIndex;

  cxGridDBTableView1.DataController.FocusedRowIndex;

  //过滤、排序操作不影响返回的结果。
 
  cxGridDBTableView1.DataController.FocusedRecordIndex


3.获得当前活动单元格的值:

  cxGridDBTableView1.DataController.GetValue(
     cxGridDBTableView1.DataController.FocusedRecordIndex,

     cxGridDBTableView1.Controller.FocusedColumn.Index);


4.动态变更cxGrid列的GetPropertiesForEdit事件中AProperties的只读属性,列的SortOrder属性值必须为:soNone;

procedure TFormDesigner.cxGridDBTableView1Column1GetPropertiesForEdit
  (Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
  var AProperties: TcxCustomEditProperties);
begin
 //动态变更AProperties的只读属性,列的SortOrder属性值必须为:soNone;

 cxGridDBTableView1Column1.SortOrder := soNone;
  if (Sender.GridView AS TcxGridDBTableView).DataController.
      DataSource.DataSet.UpdateStatus = usInserted then
    AProperties.ReadOnly := False  //此列不能排序,否则此行触发异常.
  else
    AProperties.ReadOnly := True;  //此列不能排序,否则此行触发异常.
end;


5.Rad Studio 10.1 Berlin版本,DATASNAP接口方法不支持下面的形参格式:

function ParamTest(Const ParaOleVar: OleVariant): Integer;

去掉Const形参前缀后就可以支持,支持如下声明:

function ParamTest(ParaOleVar: OleVariant): Integer;













猜你喜欢

转载自blog.csdn.net/QQ56430204/article/details/54693292
今日推荐