delphi 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;
――――――――――――――――

原文链接:https://blog.csdn.net/QQ56430204/article/details/54693292

相关阅读 >>

delph控制台(console)程序添加图标和版权信息

Delphi下获取系统默认的useragent的方法

Delphi 获取随机汉字的函数

Delphi实现win10下Delphi 10.3.1 inline hook 域名转向之internetconnecta

Delphi xe6 实现ping的功能

Delphi xe5实现datetimetounix/unixtodatetime的一点小改进

Delphi 判断uefi与 legacy bios启动模式

Delphi 检测cpu内核数

Delphi setfileattributes 功能:修改文件属性

Delphi 获取计算机从开机开始的已运行时间

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...