TECH TIP: How to Make a Data-Aware RB Component
- Publish the DataPipeline and DataField properties. These are declared in the ancestor class TppPrintable (ppPrnabl.pas).
- Override the public IsDataAware function from TppPrintable class to return True.
12345function TmyDBComponent.IsDataAware: Boolean;beginResult := True;end; - Override the public Notify method from the ancestor to redraw the design control.
12345678910procedure TmyDBComponent.Notify(aCommunicator: TppCommunicator; aOperation: TppOperationType);begininherited Notify(aCommunicator, aOperation);if (aOperation in [ppopDataChange, ppopRemove]) and (pppcDesigning in DesignState) and not(Printing) thenInvalidateDesignControl;end; {procedure, Notify} - Override SetDataField to also redraw the design control. It is a protected method of TppPrintable.
123456procedure TmyDBComponent.Notify(const Value: String);begininherited SetDataField(Value);Notify(DataPipeline, ppopDataChange);