Subject Preventing a field from being updated
Author Marc Leclerc

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 );
if (Sender.AsInteger <> CODE_DC_ACCEPTED) And (IB_QueryContributions.RecordCount > 0) then
ShowMessage('Contributions exists ! (TODO: Delete them)');

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

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.


[Non-text portions of this message have been removed]