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.
function TmyDBComponent.IsDataAware: Boolean; begin Result := True; end;
- Override the public Notify method from the ancestor to redraw the design control.
procedure TmyDBComponent.Notify(aCommunicator: TppCommunicator; aOperation: TppOperationType); begin inherited Notify(aCommunicator, aOperation); if (aOperation in [ppopDataChange, ppopRemove]) and (pppcDesigning in DesignState) and not(Printing) then InvalidateDesignControl; end; {procedure, Notify}
- Override SetDataField to also redraw the design control. It is a protected method of TppPrintable.
procedure TmyDBComponent.Notify(const Value: String); begin inherited SetDataField(Value); Notify(DataPipeline, ppopDataChange);