意外发现更改TSmartRadioGroupCondition.Caption时竟然会触发重新打开数据,所以设定TSmartRadioGroupCondition.Caption时应将ImmediateExecute为False,当高置完后再将ImmediateExecute为True, 其它用于快搜内的控件有没有此问题有待验证。
procedure TfrmCarHelp.SetHelpCondition(vCustID: variant; sEditForm: String);
begin
FCustID := vCustID;
if not VarIsNull(FCustID) and not VarIsEmpty(FCustID) then
begin
//必须:否则会触发多次打开数据。用了大半天才找到这个问题
cndValid.Properties.ImmediateExecute := False;
try
cndValid.Properties.Items[1].Caption := '有效';
cndValid.Properties.Items[2].Caption := '返仓';
finally
cndValid.Properties.ImmediateExecute := True;
end;
end;
if SameText(sEditForm, 'frmRepBill') then
cndValid.Properties.ItemIndex := 0
else if SameText(sEditForm, 'frmReFixEditor') then
cndValid.Properties.ItemIndex := 1;
end;