Handling Null values with Field Events
The OnGetText and OnSetText events, can be used to customize the output of a field. These two(2) events are extremely powerful: they allow you to use data-aware controls even when the representation of a field you want to display is different from the one Delphi will provide by default. procedure TForm1.Table1ShipDateGetText (Sender: TField; var Text: string; DisplayText: boolean); begin if Sender.IsNull then Text := '<undefined>' else Text := Sender.AsString; end; procedure TForm1.Table1ShipDateSetText (Sender: TField; const Text: string); begin if Text = '' then Sender.Clear else Sender.AsString := Text; end; |

