I'm a bit unclear about what you are trying to accomplish. All of the text components in ReportBuilder descend from the TppCustomText class (TppLabel, TppDBText, etc.). When a report is generated, each component creates a corresponding draw command and assigns it's properties so it can then be drawn to the report.
Perhaps a bit more information about what you are trying to do will help me understand the best course of action for you.
I need to create for each component in my GroupFooterBand a draw component to make it possible to draw the GroupFooter on every page like in your example "GroupFooterOnEveryPage". And because in my program the user can modify the report I need a procedure to create these draw components. Until now I figured out the following:
type TMyDBImage = class(TppDBImage) public procedure PropertiesToDrawCommand(aDrawCommand: TppDrawCommand); override; // to access this procedure which is protected end;
procedure TMyDBImage.PropertiesToDrawCommand(aDrawCommand: TppDrawCommand); begin inherited PropertiesToDrawCommand(aDrawCommand); end;
var lDrawCommand: TppDrawCommand; lComponent: TppComponent;
Your code looks fine however you are just creating a TppDrawCommand component which is the descendent to all drawcommands. It does not have all the information needed to draw and image.
You will want to create TppDrawImage objects instead (ppDrwCmd.pas).
Furthermore I do not believe it is necessary to create a custom component descendent. You could simply create a report object loop, then manually create a drawcommand for each component inside the desired band and add it to the page. Similar to the example you mentioned, you will need to create separate routine for each type of draw command (DrawText, DrawImage, DrawShape, DrawLine, etc.).
Comments
I'm a bit unclear about what you are trying to accomplish. All of the
text components in ReportBuilder descend from the TppCustomText class
(TppLabel, TppDBText, etc.). When a report is generated, each component
creates a corresponding draw command and assigns it's properties so it
can then be drawn to the report.
Perhaps a bit more information about what you are trying to do will help
me understand the best course of action for you.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I need to create for each component in my GroupFooterBand a draw
component to make it possible to draw the GroupFooter on every page
like in your example "GroupFooterOnEveryPage". And because in my program
the user can modify the report I need a procedure to create these draw
components. Until now I figured out the following:
type
TMyDBImage = class(TppDBImage)
public
procedure PropertiesToDrawCommand(aDrawCommand: TppDrawCommand);
override; // to access this procedure which is protected
end;
procedure TMyDBImage.PropertiesToDrawCommand(aDrawCommand: TppDrawCommand);
begin
inherited PropertiesToDrawCommand(aDrawCommand);
end;
var
lDrawCommand: TppDrawCommand;
lComponent: TppComponent;
...
lComponent := ppDBImage;
lDrawCommand := TppDrawCommand.Create(self);
TMyDBImage(ppDBImage).PropertiesToDrawCommand(lDrawCommand);
lDrawCommand.Draw(MyReport-Device);
So far I got, but I don't know, if this works.
So my question is how the engine does this transformation to a draw
component.
Thanks for your help.
Best regards
Christoph
Am 18.02.2013 15:48, schrieb Nico Cizik (Digital Metaphors):
Your code looks fine however you are just creating a TppDrawCommand
component which is the descendent to all drawcommands. It does not have
all the information needed to draw and image.
You will want to create TppDrawImage objects instead (ppDrwCmd.pas).
Furthermore I do not believe it is necessary to create a custom
component descendent. You could simply create a report object loop,
then manually create a drawcommand for each component inside the desired
band and add it to the page. Similar to the example you mentioned, you
will need to create separate routine for each type of draw command
(DrawText, DrawImage, DrawShape, DrawLine, etc.).
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com