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

how to picture size + some other Q

edited August 2004 in End User
Hello,
1. problem: end-user places dbImage on the report with any size.
OnGetFieldAsPicture i pass TPicture. if picture size and dbImage sizes are
different, then it is displayed not correctly, not nice.
Q: how to get info what size end-user has placed dbImage? In that case i can
draw this TPicture in original dbImage size so that it would display perfect

2. TppReport component
Q: OutlineSettings-> CreatePageNodes when it is set to true it creates
group nodes. can i somehow set to create page nodes, not groups?

3. Report Explorer
Q: As shown in example reports are saved in database and executed from
Report Explorer. How to get information what report is going to be executed?
I need to know what data to pass.

4. Q: is there any zoom tool in report preview tab or i need to make it
myself as a component ot how?

Regards,
Simonas

Comments

  • edited August 2004


    1. The TPicture Width and Height properties indicate the size of the graphic
    in screen pixels.

    To modify the size of the TppDBImage control to be the same size as the
    picture, do the following:

    if (Picture.Width > 0) and (Picture.Height > 0) then
    myDBImage.spSetBounds(myDBImage.spLeft, myDBImage.spTop, Picture.Width,
    Picture.Height);

    2. The creation of page nodes and group nodes are totally independent. From
    the Report Designer, select the Report | OutlineSettings menu option to
    display the OutlineSettings Dialog. From this dialog you can control which
    nodes get created and you can preview the effect of the modifications.

    3. Use the Report.Template events. (See tech tip below).

    4. The preview has zoom buttons and zoom edit box. If you want to further
    customize, you can create a descendant of TppPreview. See
    RBuilder\Source\ppPreview.pas. Here is an example that adds a button to the
    preview:

    http://www.digital-metaphors.com/tips/ShowPageSetupFromPreview.zip



    ----------------------------------------------
    Tech Tip: Using Template Events
    ----------------------------------------------

    The Report.Template object has several events that can be used for
    customizing what happens when a report is loaded or saved:

    - OnLoadStart
    - OnLoadEnd
    - OnNew
    - OnSaveStart
    - OnSaveEnd


    The OnLoadEnd and OnNew events are often used to perform actions related to
    report and data initialization.

    The OnSaveEnd event is often used to save additional descriptive ("meta")
    data to the database each time the report is saved.

    Example:

    The Report.Template events are public and therefore must be assigned at
    run-time.


    1. In the private section of your form declaration you can declare an
    event-handler method:

    TForm = class(TForm)
    private
    procedure myTemplateOnLoadEndEvent(Sender: TObject);

    public

    end;


    2. In the Form.OnCreate event, you can assign the event-handler to the
    event:

    procedure TForm1.FormCreate(Sender: TObject);
    begin

    ppReport1.Template.OnLoadEnd := myTemplateOnLoadEndEvent;

    end;


    3. Implement the event-handler method:

    procedure TForm1.myTemplateOnLoadEndEvent(Sender: TObject);
    begin

    {add code here to initialize the report or data, etc. }
    ppReport1.PrinterSetup.MarginTop := 0.5;

    end;



    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com







    --


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2004
    Hello,

    "Nard Moseley (Digital Metaphors)" wrote :
    graphic
    Picture.Width,

    but if end-user has placed some TPicture, i do not have right to resize it
    :) I want to generate TPicture with correct picture size

    From
    which

    can i do that from my program ? i mean that only pages (last child nodes)
    get created?


    Regards,
    Simonas
  • edited August 2004

    1. Sorry, I misunderstood the question about the image.

    a. The Sender parameter to the OnGetPicture event contains the DBImage
    object reference.

    var
    lDBImage: TppDBImage;

    begin
    if not Sender is TppDBImage then
    raise Exception.Create('Error in OnGetPictureEvent, Sender is not
    TppDBImage');

    lDBImage := TppDBImage(Sender);


    end;

    2. Yes, anything that can be done from the report designer can also be done
    via code. To control whether a group creates outline nodes, set
    Group.OutlineSettings.CreateNode to True or False.

    example:

    for liIndex := 0 to myReport.GroupCount-1 do
    myReport.Groups[0].OutlineSettings.CreateNode := False;





    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2004

  • edited August 2004

    I was referring to the DBImage.OnGetPicture event.

    DataPipelines simply respond to requests to traverse data and retrieve data
    field values. DataPipelines do not know about the data-aware controls.
    (Data-aware controls know about datapipelines - the relationship is one
    way.)

    See ppCtrls.pas, the method TppDBImage.LoadPicture is where the OnGetPicture
    event is fired if it exists. Otherwise the image is retrieved directly from
    the datapipeline by calling GetFieldAsPicture.



    --

    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.