Tcxgrid使用例子

1、更改某个单元格的值后,其他单元格的值也相应改变

直接点击单元格进行更改值,然后在改单元格增加相应的事件:

procedure Tfrm_BarCode_makecl5.gdtv_1select_ticketPropertiesEditValueChanged(
  Sender: TObject);
 var
    i_SalesCount:Integer;
begin
  try
      ReFreshMsgInTime();
      if (bDoOldBill) then
          Exit;
     if cds_Plan.State = dsEdit    then  //cxgrid关联的数据集clientdataset为cds_Plan
        cds_Plan.Post; //必须先POST后再去Edit,否则更改的值会丢失
      cds_Plan.Edit;
     i_SalesCount := cds_Plan.FieldByName('select_ticket').AsInteger;
       cds_Plan.FieldByName('tfare').Value :=  cds_Plan.FieldByName('price').AsCurrency * i_SalesCount;
       cds_Plan.FieldByName('JSAllmoney').Value :=  cds_Plan.FieldByName('price2').AsCurrency * i_SalesCount;
   finally
     if cds_Plan.State = dsEdit    then
        cds_Plan.Post;
     CountMoney();
   end;
end;

 

posted @ 2018-11-05 17:30  KunSun  阅读(340)  评论(0编辑  收藏  举报