我看了OnDataChange的方法,感觉跟我说的不一样。‘
我以前有个代码:
procedure TMAINFORM.DataNavigatorBeforeAction(Sender: TObject; var Accept: Boolean);
var laccept,lfffs,lfs,lsy,llaccept,llfs:Integer;
begin
DataNavigator.SetFocus;
lsy:=INFODRAWING_MANAGE_INFO.TDRAWING_PARTICULAR_INFO(DocViewDrawing_Particular_Info.Doc).DataSetBrokerSum.DataSet.FieldByName('SYFS').AsInteger;
lfs:=INFODRAWING_MANAGE_INFO.TDRAWING_PARTICULAR_INFO(DocViewDrawing_Particular_Info.Doc).DataSetBrokerSum.DataSet.FieldByName('Dispense_Num').AsInteger;
llfs:=INFODRAWING_MANAGE_INFO.TDRAWING_PARTICULAR_INFO(DocViewDrawing_Particular_Info.Doc).DataSetBrokerSum.DataSet.FieldByName('Dispense_Num').AsInteger;
INFODRAWING_MANAGE_INFO.TDISPENSE_PARTICULAR_INFO(DocViewDispense_Particular_Info.Doc).DataSetBrokerEng_Drawing_Dispense.DataSet.Edit;
INFODRAWING_MANAGE_INFO.TDISPENSE_PARTICULAR_INFO(DocViewDispense_Particular_Info.Doc).DataSetBrokerEng_Drawing_Dispense.DataSet.Post;
laccept:=INFODRAWING_MANAGE_INFO.TDRAWING_PARTICULAR_INFO(DocViewDrawing_Particular_Info.Doc).DataSetBrokerEng_Drawing.DataSet.FieldByName('ACCEPT_NUM').AsInteger;
lfffs:=INFODRAWING_MANAGE_INFO.TDRAWING_PARTICULAR_INFO(DocViewDrawing_Particular_Info.Doc).DataSetBrokerSum.DataSet.FieldByName('FFFSTJ').AsInteger;
if (laccept<lfffs)then
begin
jsDialogs.ShowMsg('分发份数大于接收份数,不能保存,请重新编辑','提示');
Accept:=False;
INFODRAWING_MANAGE_INFO.TDISPENSE_PARTICULAR_INFO(DocViewDispense_Particular_Info.Doc).DataSetBrokerEng_Drawing_Dispense.DataSet.Cancel;
INFODRAWING_MANAGE_INFO.TDISPENSE_PARTICULAR_INFO(DocViewDispense_Particular_Info.Doc).DataSetBrokerEng_Drawing_Dispense.DataSet.Edit;
INFODRAWING_MANAGE_INFO.TDISPENSE_PARTICULAR_INFO(DocViewDispense_Particular_Info.Doc).DataSetBrokerEng_Drawing_Dispense.DataSet.FieldByName('Dispense_Num').AsInteger:=lfs;
INFODRAWING_MANAGE_INFO.TDISPENSE_PARTICULAR_INFO(DocViewDispense_Particular_Info.Doc).DataSetBrokerEng_Drawing_Dispense.DataSet.FieldByName('SYFS').AsInteger:=lsy;
INFODRAWING_MANAGE_INFO.TDISPENSE_PARTICULAR_INFO(DocViewDispense_Particular_Info.Doc).DataEditDataSetBrokerEng_Drawing_Dispense.SetFocus;
end;
end;
但是我现在要在一个新的弹出窗口中做判断,没有DataNavigator,就无法用到这个事件。。。。所以我就是想问其他什么方式可以实现上边的方法。 |