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

Changing Print Preview Default Settings

edited March 2002 in General
Is there an easy way to change the Print Previewers default settings? I
would like the previewer to come up in a maximized window with the page at
100% zoom or page width zoon. How do I do it?

David Miller

Comments

  • edited March 2002
    You can control the built-in preview form via the Report.OnPreviewFormCreate
    event.

    For example the following code sets the Print Preview form to maximized and
    sets the Viewer ZoomSetting to 100%:

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
    begin

    ppReport1.PreviewForm.WindowState := wsMaximized;
    TppViewer(ppReport1.PreviewForm.Viewer).ZoomSetting := zs100Percent;

    end;


    Note: You will need to add ppViewr to the uses clause of your unit, so that
    the ZoomSetting enumerated type is recognized by the compiler.



    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited March 2002
    Jim Bennett (Digital Metaphors) wrote:

    That same question has been asked here and also answered, with the
    answer lines above, 54 times during the years 1999-2002.

    Yet this advice is nowhere in the manuals, examples or help files.
    And yes, even if it works, it's just a work-around!!!!

    Write 100 RB reports, and you'll have to add those lines to all of
    those reports manually! How clever.

    If I get the same answer fifth time from my customers, I do not
    fix it any more with work-arounds, or put more folks on phone support.
    I'll fix my app, so the same question does not rise any more, and
    does not eat my valuable time.

    I don't know how the time of DM support personnel has been valuated.
    But it looks strange to me, that this thing has *not* been fixed, nor
    better dodumented. Even after 54 different people asking the same
    question.

    I can see that DM folks have written a lot of sophisticated code. I
    don't know yet if the re-write of the whole Printer unit was good
    or bad. But it shows they are really trying.

    Yet this sloppyness in many places, and weak and slow responsiveness,
    these still make my temperature to rise high and rise fast.
    I wonder if these same small, but annoying preview problems are going
    to be still in RB 6.04?

    With all this whining, I'm not saying that I would be leaving RB
    behind me. I'm better saying I'm going to keep these positions for
    the moment.

    I just looked through the 3..5 other competing report alternatives.
    Some things they do better, but they also seem to miss something,
    either reasonable support or some product features.
    Even if not a complete product, it now looks like it's still wiser
    to stay married with RB, than start going elsewhere.

    But please, put your effort to fix the things right in to your product
    and documentation.
    Instead of spending your time, year after year with un-productive on
    line support. On areas that could be easily and quickly fixed.

    -Barry
  • edited March 2002
    I concur with you Barry. I was using Quick Report Artist, a $75 product,
    and I miss simple things it has that Report Builder doesn't. But, the
    foundation of Report Builder is superb, and much better. The eye appeal is
    great, which is very important for a Report writer. So, I'm not thinking
    about leaving it. :-)

    What would be nice about this print previewer is if there was an expandable
    print preview properties where these things could be easily and quickly set.
    Another less desireable possibility but perhaps easier to implement is to
    have a simple text configuration file read during compilation where all
    these details could be set for all my applications. I can't imagine a
    single application where I want the previewer to come up with its normal
    default settings.

    David Miller

  • edited March 2002
    Thanks Jim. I appreciate the specific code you offer VERY MUCH. Thanks.

    David Miller

  • edited March 2002
    Hi Barry,


    look at the demos!


    It is normal code, no workaround (around what?).


    I have hundreds or reports and wrote this code ONE time.


    Nothing to fix, but sure we all would like to handle it simplier by
    properties.



    It is the fastest NG I've ever seen!


    regards,
    Chris Ueberall;
  • edited March 2002
    Hi Chris. Please forgive us. As for me, I think I just get a little
    frustrated learning something new. You say look at the demos, but there are
    a lot of demos. A lot of information. Quite overwhelming. I generally
    search the manual for phrases like "Preview Form" or other key words. By
    the way, which demo documents this Print Preview change?

    Note that I have worked through the "Learning Report Builder" tutorial and
    also read the manual very closely. The problem is that there is just so
    much information, that little things like this aren't clear until they are
    needed. Then a search in the manual turns up nothing. Help turns up
    nothing. You guys have a lot of documentation, so it is not easy finding
    that little piece of information that makes things work well. I would
    recommend just adding a statement to the help file and indexing relevant
    keywords. That shouldn't be hard, and updated help files could be available
    for download. If I could just go into a Report Builder help file and find
    this kind of info by looking at index "Preview Form," that would have helped
    a lot.

    I think the problem with this particular incident is that it has come up
    from many other users. A little thing like this can be frustrating, and
    most of us buy something like Report Builder because we don't want to spend
    a lot of time coding things. If the behavior of a component is such that
    you always have to remember to go into an event and code something, get the
    right syntax, find that example syntax that you haven't looked at for six
    months, well, that is a pain. Sure, you might have hundreds of reports for
    which you wrote that code only once, but what about the next time you drop a
    report component down? You are going to be looking for that code again so
    you can make the preview form come up as it should.

    The response to this particular question was the best I have ever gotten in
    this newsgroup, but answers to other questions were always a little weak.
    By weak I mean that I am unable to understand. I had almost given up using
    this newsgroup as a resource. In fact, I have been asking Report Builder
    questions in another newsgroup.

    As for speedy responses... Have you checked out the Turbopower FlashFiler
    newsgroup? That is the fastest newsgroup that I have ever seen. I'm
    talking responses almost always within hours, not a day. Good answers too.
    Nevertheless, it is hard to compare any newsgroup with that one. I'm not
    faulting you for that. It would be nice to get same day responses, but next
    day responses are better than none or next week. :-)

    I'm very glad that we have a newsgroup here, and I'm very glad for Report
    Builder. It is a nice product, so nice that we all expect it to be perfect.
    We get disappointed when we realize that it isn't perfect, but it is still a
    great product.

    David Miller

  • edited March 2002
    Hi David,

    first let me say, that I am not working for DM, I'm a user like you.


    Hit and look for 'PreviewForm.Viewer).ZoomSetting' in folder
    'RBuilder', then you'll find all places where it is used.


    you can do a fulltext search by your own, that's a standard Windows help
    feature.

    too.

    question : Concatenate Fields from 2002-02-08 14:51
    answer : from Tom Ollar at 2002-02-08 16:19
    delay : 1.5 hours

    question : Getting started 2002-01-14 18:27
    answer : Jim Bennett 2002-01-14 18:27 19:52
    delay : 1.5 hours

    question : What does pp stand for? 2002-03-04 05:20
    answer : Bruce Roberts 2002-03-04 06:17
    delay : < 1 hour

    a

    No problem so far, because all necessary settings and doings are done by my
    framework automatically.
    When I have to remember on 'how to do that special thing' I look into my
    reference projects and/or use .


    I think that's the point here.

    regards,
    Chris Ueberall;
  • edited March 2002
    I've added the code to two different TppReport components, to their
    OnPreviewFormCreate event. Neither of them have any effect. The code
    compiles fine. If I do an F4 to compile (Compile to Cursor and Break), the
    event evidently never fires because I never get a break there. What might I
    be doing wrong?

    I'm using Delphi 5 with Report Builder Pro 6.03 and FlashFiler 2 database.

    David Miller


  • edited March 2002
    David Miller wrote:

    Chris wrote:

    Hey, what's this F3 thing? Where do you hit F3? That repeats a search in
    Delphi.

    I guess this is what is meant by "weak answers." Some of us guys are not as
    sharp as others. You say, "hit " and look, but I hit F3 and nothing
    happens. :-)

    So please tell me how to do this. This sounds interesting. You mean that I
    can somehow search all the demos for a Preview string? How would you know
    to look for "PreviewForm.Viewer).Zoomsetting"?

    Chris wrote:

    Yes, but keywords not specifically used in the text do not show up. I was
    able to use your tip to find in the help file the answer that Jim gave. It
    was under TppProducer.OnPreviewFormCreate. So you are right, the
    information is in the help system, contrary to what Barry said, but still,
    there isn't enough information for me to get this to work. I guess I'm
    missing something yet again.

  • edited March 2002
    Chris Ueberall [TeamDM] wrote:

    I see you are a TeamDM member, I wonder if this is also the DM's
    official answer.

    But sure you can do that, and anything else too, if you write your
    own Class for that. That just is not a decent offer from a Mercedes
    class reporting tool: Do It Yourself.

    (Well, still some of the early 1980 Mercedes Benz models had a window
    washer where the driver pumped the water by a foot pedale to the
    windscreen:) Now this good Old Folks thing has disappeared from MB. )


    When you look at the RB examples, all the examples describe *only* that
    situation, how you drop a Preview component on your Form. And add the
    ZoomSetting code to the report's OnPreviewFormCreate event.

    And when you do it this way, you'll have to include these lines of
    code to all of your 100 reports. A home made solution, that is even
    not documented in the Manuals.

    Of course, after writing it the 50th time, you start thinking that is
    there some more clever way to do this. I just think that it's the RB
    writer's task to do that, put then to their package in an easily
    adoptable form, that is, a Property.

    The current situation is a work around situation. And it makes
    me wonder why it has been here this way, all the way from 1997.

    ---
    I'm not a component writer, but application developer. The every day
    needs and discussions with my clients have nothing to do with creating
    new Reporting Tool classes.

    Beside RB, I have a dozen of other commercial component packages to
    deal with. And all they are just black boxes to me.
    I'm not interested to touch anything inside them, and I'm happy
    when it works that way.

    All my time goes in that, that I try to write the functionality
    my client wants. Reporting is not such a intersting area, that
    I would like to dig deep in to Classes or anything within it.

    Just make the reports my client wants, and in 100% they want
    them maximized in 100% size. I see the other developers here
    sayying also their customers want to preview in that way.

    Then, why does not RB offer this kind of, very commonly needed
    functionality?
    No real or sensitive ear for the customer needs for 5 years:(

    ---
    As Barry, I know this is a dangerous thing, to criticize any work
    where the good and professional people have put years of their
    life.

    The receiver usually does not accept any of it, but considers
    it as an personal attack against himself and his products.

    I myself would not have started any of this in the first place.
    Just quietly brought my things and gears from QR to RB, and kept
    my mouth shut all the time.

    -Barry
  • edited March 2002
    Be sure to reassign any event handlers to the report, after you load each
    report template (rtm) into the report component. This is most likely the
    problem.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited March 2002
    David,


    Hit anywhere on the Windows desktop or Explorer.

    as

    I plan to wrote a book about the meaning of in Windows, until that the
    short explanation should do it! :-)
    You may also use Delphi's search in files feature or a GREP utility.

    I

    It was said that there is nothing about the 'Zoomsetting' in the demos,
    therefore it is simple to know what searchstring must be used.


    If you have a real serious problem, where you can't wait a few days, you
    should better contact the support directly.
    Sure it is sometimes possible that one overlook a thread, is busy ,ill or
    ... it is a NG.

    maximize

    you are working with templates, right?
    Then you have to reassign the events after loading, here the
    'TppReport.'OnPreviewFormCreate' event.
    When you are using the ReportExplorer, this should be done in the
    'OnLoadEnd' event of the template, which must be assigned just after a
    report is selected, I use here 'TppDesigner.OnReportSelected'.

    feel free to ask more questions,
    Chris Ueberall;
  • edited March 2002
    Hi Barry,


    No, I'am answering my way. I do NOT work for DM. I am a developer like you.


    You don't need new classes for reusing code.


    use the second time ;-)


    my short answer here, the coding for Preview's zoom setting is so simple
    that I'll do it by myself, but there are much more other features, which
    can't be simply done by us. The focus should be kept on the latter thing by
    DM.
    (I managed the zoom setting by myself by reading the
    code/documentation/tech-tips, I can't remember any difficulties, lucky by
    chance :-)).

    regards,
    Chris Ueberall;
  • edited March 2002
    You're right, you have to code an event handler for each report component in
    your app to get a 100% zoomed preview screen. I've added a new property on
    the report component which will allow you to configure the preview form at
    Delphi design time. This will be in the next manitenance release. If
    you've coded the OnPreviewFormCreate events in you old reports, you won't
    have to change anything, they will work as before. This new property simply
    lets you define the settings before hand. The settings you make on the
    preview form in the OnPreviewFormCreate will override the settings that are
    given by the new property on the report.

    Report.PreviewFormSettings.ZoomSetting
    Report.PreviewFormSettings.WindowState


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited March 2002
    Hey, that's great! Now that is fantastic response to customer need. Thank
    you.

    Now, Barry, don't forget to thank the man. :-)

    David Miller


  • edited March 2002
    Chris wrote:

    Yes.

  • edited March 2002
    Excellent.

    ------------------------------------
    Bruce Roberts
    Roberts Browne Limited
    RBAddOn Components for Report Builder
    http://www.bancoems.com/rbaddon.htm
  • edited March 2002
    David Miller wrote:

    Yeees, thank you for the men at DM (and the nice blonde girl at the
    reception desk).

    And don't forget to put the Close on ESC feature to Preview also.

    I'm not sure if I got everything off my chest. But if the marriage
    with RB remains, I'll probably be back with the naggings. As in
    every decent marriage.
    If nothing is to be heard, everything goes fine.

    -Barry
This discussion has been closed.