Subject | Preventing a field from being updated |
---|---|
Author | Marc Leclerc |
Post date | 2001-03-15T17:34:58Z |
Hi,
I have a LookupCombo which I am trying to prevent changing on certain condition. So far no luck.
This don't work
Procedure TEditRequestDlg.OnValidateDecisionCode (Sender: TIB_Column );
begin
if (Sender.AsInteger <> CODE_DC_ACCEPTED) And (IB_QueryContributions.RecordCount > 0) then
begin
ShowMessage('Contributions exists ! (TODO: Delete them)');
Abort;
end;
end;
The warning is displayed but the value has changed
I have also tried using Field.Revert within the OnDataChange or for that matter re-assigning the value directly without success.
I do not want to disable the control all together as this may leave the user clueless as why he cannot change the field.
I though that calling an exception within the field.OnValidate would cause the change not to take place
<snip>
Event to validate the new value written to the field.
If the new value is invalid then raise an exception to cause it to be rejected.
<snip>
TIA
[Non-text portions of this message have been removed]
I have a LookupCombo which I am trying to prevent changing on certain condition. So far no luck.
This don't work
Procedure TEditRequestDlg.OnValidateDecisionCode (Sender: TIB_Column );
begin
if (Sender.AsInteger <> CODE_DC_ACCEPTED) And (IB_QueryContributions.RecordCount > 0) then
begin
ShowMessage('Contributions exists ! (TODO: Delete them)');
Abort;
end;
end;
The warning is displayed but the value has changed
I have also tried using Field.Revert within the OnDataChange or for that matter re-assigning the value directly without success.
I do not want to disable the control all together as this may leave the user clueless as why he cannot change the field.
I though that calling an exception within the field.OnValidate would cause the change not to take place
<snip>
Event to validate the new value written to the field.
If the new value is invalid then raise an exception to cause it to be rejected.
<snip>
TIA
[Non-text portions of this message have been removed]