Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Is there a way to assigning a TppText to a TppDrawText Component?

edited February 2013 in General
Hello

Is there a way assigning a TppText to a TppDrawText Component?

Thanks for the help.

Regards
Christoph

Comments

  • edited February 2013
    Hi Christoph,

    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.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2013
    Hello Nico

    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):
  • edited February 2013
    Hi Christoph,

    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.).

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.