This is done by handling the xxBeforePrint() events, finding the correct controls and set the
Enabled
property to false. I didn't have a lot of documentation on the QuickReport so it involved a bit of trial and error. The solution:1. First hook up the event handler at some appropriate place
// In order to disable LT analysis if not activated
if RptFrm_Header.QuickReport.Bands.HasTitle then begin
RptFrm_Header.QuickReport.Bands.TitleBand.BeforePrint := QRFuelRepHeaderBeforePrint;
end;
2. In the event handler, find the right controls and disable them
procedure TFrm_FuelRep.QRFuelRepHeaderBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
const
controlNames : array[0..2] of string =
(
'ReportLabelLT_Status',
'DBImageLT_Status',
'DBTextLT_Status'
);
var
name: string;
component: TComponent;
begin
for name in controlNames do begin
component := RptFrm_Header.FindComponent(name);
if (component <> nil) and (component is TControl) then begin
(component as TControl).Enabled := False;
end;
end;
end;
Ingen kommentarer:
Legg inn en kommentar