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

previewform maximized

edited February 2002 in General
Hello,

I'm using RB 6.03 and when I set previewform.windowstate := wsmaximized in
the create of the previewform it does not maximize.

Any ideas?

Thanks,
Dominique.

Comments

  • edited February 2002
    If you are loading a template, then make sure that the event handler is
    reassigned to the report after the template is loaded. There are articles in
    the tech tips newsgroup which describe how event handlers get lost, and
    also, on how to maximize the screen preview in the OnPreviewFormCreate
    event.


    Cheers,

    Jim Bennett
    Digital Metaphors Corp



  • edited February 2002
    Bernaert Dominique wrote:

    I have the same problem. I have worked with QR for several years,
    done dozens of complicated reports with it. And through those years,
    I often thouhgt that QR was bad.

    But now, after struggling three days with my registered Report Builder
    6.03, after that working with QR is a breathe.

    The RB documentation is HUGE, over 400 pages. But the PDF manual is
    also incredibly bad, and somewhat broken also. I try to make Acrobat
    Reader to skip to page 54, where there's something about Preview, but
    Acrobat brings me to page 34. I try to go to 75, I get to page
    55 etc. Is this some European, A4 paper size problem only, or what?

    Finally I started to scan the PDF through with FIND. Now I have scanned
    the whole 400 page manual through, several times with keyword "preview".
    But I still can't find a single example how I could get the Preview
    window open in whole screen page mode.

    I have tried several ways
    ppViewer1.ZoomSetting := zsPageWidth;
    ppViewer1.ZoomSetting := zs100Percent;

    but these have no effect, the preview still opens in small 4 x 6 inches
    size.
    Also the Preview Window often opens blank, both in design mode and
    runtime mode. And I can't find a reason for this. Then it suddenly
    comes back again, and then again soon opens blank, no matter what.

    The huge examples collection won't help me either. It has examples
    to use: ppViewer1.ZoomSetting := zsPageWidth; but as said, this does
    not have any effect.

    Then I come to these newsgroups, and try to find something with
    Google, but Google does not cover these groups. And I can't find
    Digital Metaphors own search engine either.

    Is there some way to search these newsgroups?

    Then I again start scanning this newsgroup with FIND, through all
    the 20.000 articles. And I finally find this question from Bernaert
    Dominique, where he asks the same thing.
    But there's no answers, no one has answered anything:(

    One of the several frustrations: Why can't I save my work, when
    the Design window is open? Why must i first switch off from the
    Design window, and now I can save my report to disk.

    I also miss the feature, that I could copy the RB objects to
    clipboard, and to Notepad, and back again.
    A standard Delphi feature. But I have not found any ways or work
    arounds, how I could do the same with RB's printing objects.

    I have already come over the fact, that in the minimum RB adds
    quite a big chunk, about 1.2 MB to the executable. QR made it
    with 600 kB, and Fast Report with 400 kB. And yet Fast Report
    comes with their built in HTML and Excel export, and many
    other things already installed.

    Then rhe QR to RB exporting tool (Waler) does not work, but hangs,
    even with the simplest QR reports.

    RB's documentation is big, but it is not good. It looks more like
    a colorful brochure than a handbook, there's almost no example
    snippets in it.
    And all the \DEMOS examples are built around inside one HUGE DPR
    example project.

    This is very bad schema to teach anything for a beginner. I would
    like to see several independent, and also small reporting examples
    to start studying.
    Is there really no other RB example collection available, than
    that one which comes with the package?

    This steep learning curve after QR, it was quite a surprise for me.
    Currently, I could not be much more frustrated and angry about all
    this hassle.

    I'm sorry for my pseudonym. I'm just so angry now, that I may be
    also quite unfair against Digital Metaphors.
    And that's not what I want. I only want to get answers to some things,
    and according to them be ready to decide, to which direction I should
    continue.

    Should I still try it, or will it get just worse? I have paid this
    thing, and can live with that loss. But should I still spend much
    more time with it, if it still feels this hopeless.

    -Barry
  • edited February 2002
    "Barry" wrote in message news:3C7E72B5.4377@nomail.no...
    in

    No, that's Adobe Acrobat. That will happen with ANY document which is paged
    and has a table of contents or other pages before the actual page 1 of the
    document. That has nothing to do with RB's documentation. You just have to
    learn how to use Adobe Acrobat's "Go To Page" capability.



    Use this...

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

    You also have to place ppViewr in your uses clause.

    This code has been shown in the NG many times.

    It sure does. See my example above.




    Try using your newsreader's search capabilities.




    The demos that come with RB are quite easy to follow and very helpful.


    Any learning curve away from QR is worth it. The power of RB is phenomenal.
    Just don't give up too soon.
  • edited February 2002
    Sorry...it should be:

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

    I forgot to put the "1" after "Report" on the first line. "Report1" being
    the name of your report.


  • edited February 2002
    Hi Barry,
    You're wound up after a bad day/week/year - we've all had those. Generally
    RB is an excellant product, and the support team very responsive and
    helpful. Hang in there!

    However, some of the points you make are valid

    The PDF manual is large and not as "nuts and bolts" as I would like, but
    there are good resources elsewhere.

    The demo project has a lot in it and if helpful, but maybe some separate
    projects (less expansive, more realistic) could be a help too for beginners.

    The news group relies upon your own newsreader. For me that is Outlook
    Express, and I hate it. It always clears the tech-tips and you have to
    remove the newsgroup compeletely, close, open and resubscribe to get all the
    entries back. So unless you freshly download the whole group there is no way
    to search etc. Consequnetly the same questions get repeated because the
    previous answer is hard to find (if you ever downloaded it then your browser
    has deleted it etc.).

    DM, an online search of these useful groups would be so nice....... Are
    there reasons why you don't do this?? But the frustration is OE.


    But you are wrong here. People do answer, and are helpful.


    Stick with it. Use the newsgroups, but please provide a full name and
    email - it is only polite :)

    Sarah
  • edited February 2002
    I use Netscape for a newsgroup reader, and feel it is the best out there.

  • edited February 2002
    > I have the same problem. I have worked with QR for several years,

    I must respectfully disagree. I've also worked a lot with both tools and RB is
    light years far good from QR. I simply love the tool.
    Maybe you're not still comfortable with it because your big background with QR
    but i'm even migrating all my old QR reports to RB in order to have QR out of my
    life forever.
    The code for maximizong the preview window works perfectly.


    I agree some update of the documentation is needed but, the first thing i did
    before creating the first report was reading RB documentation and doing the
    examples. And after that all goes fine, no complains.
    It's a very complete documentation that covers all you need to create a great
    variety of reports... try looking QR documentation... almost nothing available.


    I agree again, but i don't know a single manual covering all the cases. RB is a
    huge tool, with a lot of capabilities, controls... don't think in it as another
    QR, much smaller and simpler. (not easier).
    Even Delphi documentation doesn't covers all the topics, that's why this
    newsgroups exists.


    This is some i also want: The preview report window should be maximized as
    default. Almost all the applications, users and developers need it that way.
    Minimize should be the option, not the rule.


    Already answered with the correct code.


    Strange... i asked the same thing a time ago and had the answer the same day.


    I think you can't. On the RB documentation says that the report designer is
    "just" a very complex property editor, not a Delphi window itself.


    As i said before, you simply can't compare QR with RB. They are worlds away. RB
    is a professional and HUGE tool.


    False, i'm using Waler's component since almost 6 months and works fine. ALL my
    reports need to be exported to Excel and i have no problems. (The little bugs
    founded were solved for James Waler soon).


    ??? Had you really read it??? I've learned RB using only that "brochure". It
    covers almost all the issues you need for any kind of report creation. Even for
    the custom user's reports, what is really simple.
    I begun to deply end user's reports just a few hours after i begin to read the
    chapter.
    Try doing it on QR with all the query tools, DADE and so on... you'll become
    gray haired soon, if you even can do something similar to what RB has.


    Now i see you didn't read the documentation. The presented examples a really
    step by step ones... even starting with "Put a ttable object from the database
    palette". Want anything more simplier?
    Also the reports in the demos project are step by step, and some of them are the
    continuation of previous ones.


    Then an advice: keep QR. A terrible wrong decision, but it's your decision
    finally.
    If you just begin to really learn RB, this post never been posted. It's the most
    amazing and great tool for Delphi reporting (and maybe for reporting in
    general), and it's not say by me, not even for Digital-Metaphors... check the
    Delphi informant, the Delphi newsgroups and the report tools documentation
    available.


    With all my respect... saying that RB is a bad tool and that QR is better than
    it, i almost like saying that VB is a lot better than Delphi.
    I worked with QR for 3 long years doing a lot (A LOT) of reports, their support
    is terrible, it's the time i have unanswered questions, not very powerful,
    tricky... IMHO just a poor tool.
    You had been very unfair with RB and i don't work for them, i'm just a customer
    like you, but i don't like to see good tools being attacked with not well based
    arguments.
    Hope you recover your good mood :)
    bye
    --
    Guillermo Castaño Acevedo
    Gerente de Sistemas - Grupo Millennium Ltda
    GuillermoC@GrupoMillennium.com
    www.GrupoMillennium.com
    Quid quid latine dictum sit, altum viditur
  • edited March 2002
    I 've the same bad mood for a while when start working with RB, but believe
    me, this tool is great, i've tried other reporting tools and RB was my
    choice.After you learn how to work you will see.
    Keep going, and in a while you will be happy, you just need to do things in
    the best way.
    After more than 300 reports i'm very happy with RB.I can now do hard reports
    in a easy way.

    Of course the manual is incomplete, sometimes advanced properties and
    functions aren't there, but i believe that DM will update manual in the
    future.

    You made the right choice.

    Artur Azevedo


  • edited March 2002
    Sarah Ashton wrote:

    Thanks for the sympathy Sarah :)

    My problem is, that asking these very basic questions about the
    reporting tool, I would not like to appear here at all with them.

    I would just like quickly to find and read the answer in Delphi
    RAD style, either:
    a) from the online Help
    b) from the manual
    c) from the demos that came along

    and then go on. But when I can't find the *basic answers* from
    any of them, well that is a quick blood pressure rising thing
    to me.

    This time the right answer was this code:

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

    But the sender of the code said "This code has been shown in the
    NG many times."

    Well, if that is so often asked question, then why the heck can't
    it be told in any of the Demos, or the Manual or in online Help ????

    The only way to find this piece of information myself would have to
    download and scan through the 20.000 article database. This is so
    clumsy, when I have one PC in work, one at home and the third is the
    portable.

    Now I have got the Preview window maximized. But the second question
    is, why does this preview not close when I hit ESC-key? There seems not
    be any property that would make Preview work with this common and
    widely used (MS-Office, IE etc) way. Close preview on ESC.

    Do I have to write my own preview window, to get this happen?

    I know that helping people that are already grumpy is not a pleasant
    task, but please, if anyone could help me with this ESC problem.

    RB should be the Mercedes of reporting tools:) That's what I expected
    after QReport. And that's why I'm grumpy with these very unexpected
    and very basic and annoying, new Mercedes owner difficulties.

    ---
    By the way, one thing that is no fault for DM. I have always
    hated the PDF format, and especially the Acrobat Reader that is
    used to read that stuff.

    This Mac product, with hand formed cursor, and odd short cuts and
    jumpy scrolling and zooming on screen, that is not for me. And a
    Table of Contents feature, that brings you to wrong page numbers
    on a 364 page hand book..

    Where did the old Word formatted Report Builder document go?

    At least you could easily Cut/Paste code snippets from there, but
    you can't do it with PDF.

    ---
    I still suggest to break that huge demo to some smaller chunks.

    Add some simple demos for starters, where the Preview Form is
    treated and handled elegantly. Show the right events where to put
    several settings etc. Show the way DM suggests to deal with it.

    Well, now I have got something to work now with RB, and I still
    keep struggling. I hope I can abandon this pseudonyme very soon.


    -Barry
  • edited March 2002
    Barry,

    I sympathise with your point of view. I stared at RB for months but could
    never get figure out how to get started but last month something just
    clicked (light bulb style) and I was off and running! Once I'd passed that
    initial hurdle of "I know how QR does this - now how does RB do it?" things
    definitely came together. Keep at it!

    Now I couldn't go back to QR/QRD. Ever.

    BTW You can search these newsgroups at www.fulltextsearch.com

    Kev
  • edited March 2002
    Well it seems that DM are dealing with a grumpy user by letting us satified
    customers handle it. And Barry, as you see there are plenty of us that find
    the learning curve and frustration worth it.

    Yes, it would be nice if the answers to some questions were in the help,
    manual, demo etc. But having written these kind of things I know that it is
    almost impossible task to cover everything. Instead DM support the
    newsgroups and continue development.

    So ask the obvious, and keep it brief, and answers will appear. Not ideal,
    and simple things appear repeatedly, and it is unwieldy to search etc. But
    ask your "ESC"/preview question in a new thread without loosing it in the
    grumps, and someone will answer.

    Anyone like the job of scanning the common questions from the entire
    newsgroup and updating the tech-tips????

    Sarah
  • edited March 2002
    Now why didn't someone tell me about this before!!!

    "Kev French" said
  • edited March 2002
    Sorry, you are frustrated. We are very proud of our active customers on the
    newsgroup and all of our resources in general. I hope you take a look at
    our TechTips newsgroup to search for answers. That might be better than
    searching in General. There are only 100ish articles in TechTips, for
    common problems. The newsgroups are here so that you can ask the guys who
    wrote the product questions about "why this is doing that." The developer's
    guide is over a year old. We are planning to go through it and bring it up
    to date in the future. We do sell a printed version of it for $30.

    I read through these posts, and I wanted to add one note for future
    reference. If you are loading a report template, it is possible that the
    event handler may get assigned when the report is loaded. There is a
    TechTip newsgroup article on why event handlers get lost. You'll simply
    need to reassign the OnPreviewFormCreate event handler after the template is
    loaded:)

    Here's what you need: Pressing the Escape key when the preview is shown,
    will close the preview form in this example link below. It is a full working
    simple Delphi 6 project I created this morning. Essentially, it shows that
    you can replace the RB preview class with a descendent that overrides the
    KeyDown method and closes the preview form. RB is very powerful and I hope
    you stick with it.

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

    procedure TppMyPreview.KeyDown(var Key: Word; Shift: TShiftState);
    begin

    inherited KeyDown(Key, Shift);

    case Key of

    VK_ESCAPE: PerformPreviewAction(paClose);

    end;

    end;

    I'm using OE and its searching has been working well since I moved to a new
    machine a couple of weeks ago. Of course, now that I've said this, it is
    going to flake out:)

    Cheers,

    Jim Bennett
    Digital Metaphors

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

    Thanks for all the answers, and overall understanding. I'm starting
    to feel a bit better now, when I got the five first simple QR reports
    converted to RB.
    Then it's time to try the tough ones. Reports with a lot of code
    written inside several QR control's events.


    This looks good, but looks there's still some problem. If you press
    any of the Zoom buttons on the Preview form, then ESC won't work any
    more.

    There is a property ModalPreview for TppReport. When you turn this
    on, and Preview is opened, then Delphi Modality takes care that you
    can't do anythine else with your app, but close the Preview Form.

    ESC is an overall Windows standard to close all the Modal Forms.

    So what is the idea, why the Close button still is *not* the default
    button for ESC key, even though ModalPreview is turned on? There's
    no other obvious buttons on Preview form to choose to press.

    Also, is it a DM suggestion, that I put this initialization code to
    all of those 100 reports I'm gonna make:

    initialization
    TppPreviewPlugin.UnRegister(TppPreview);
    TppPreviewPlugIn.Register(TppMyPreview);

    finalization
    TppPreviewPlugIn.UnRegister(TppMyPreview);
    TppPreviewPlugIn.Register(TppPreview);

    If that is the suggestion, I'll do it. And then I'll include the
    Preview Form's Maximizing lines there also.

    These questions may sound like splitting the hair. But I just wanted
    *not* to start scanning through RB's 260.000 lines of very challenging
    looking code.

    I did that a lot with QReport, several weeks of debugging and studying
    the QR code in total. And I would not like to go there, at least not
    with the very basic questions yet.

    -Barry
  • edited March 2002
    On Fri, 1 Mar 2002 05:12:22 -0600 , Barry wrote:


    I bougth RB professional 2 weeks ago and in some respects I understand
    your frustration. The first two days I felt like throwing the whole
    stuff out the window. But then I started to understand the way RB
    works. In no time I changed a whole application to RB. One week ago, I
    upgraded to RB Enterprise. And believe me, this thing is simply
    genius. RB offers features you only estimate when you have learned how
    to work with it. This is not easy at the very first time. I agree with
    you. But I also remember having hard times using QR + QRDesign or
    Crystal Reports.

    I used to build my reports using QR, QRDesign and Crystal Reports.
    I almost finished developing a big application, when I realized that
    printing doesn't fit the demands of my customers.

    For instance, using QR you simply are not able to switch papersources
    while executing a report. Maybe on an old Laserjet II that may have
    worked. But on a modern 5-Tray printer you can forget it. When
    developing professional applications this is essential.

    While Crystal Reports is also a great product, in many respects not as
    ideal as RB. It's is slow and there are also some enduser installation
    issues.

    Now with RB my customers can modify their reports themselves and
    all this is compiling into one application.

    Using RB as the printing tool and DBIsam as a Database-Engine makes
    Delphi complete and a joy to work with. So stick with RB and don't
    look back. You will not regret that. And I'm sure you also had a
    reason to buy RB in the first place, didn't you?

    Cheers,

    Michael

    (ps No, I'm no stockholder of digital-metaphors)
  • edited March 2002
    The points are valid. Period.

    I hope DM fixes them.

  • edited March 2002
    The register/unregister calls just need to be placed in the one unit where
    your new preview plugin class resides.

    You can create a TppReport descendent which has the OnPreviewFormCreate
    maximizing code in it. See the thread in this newsgroup on Zoom in
    ppDesigner Window. There is some example code given by one of our customers
    who did this. This way you can use the descendent to control the preview
    form, instead of trying to assign an event handler to every report that is
    previewed.

    Sorry, I quickly looked at the interface section of TppPreview and saw that
    I could hook into that event. You're right, once the buttons get clicked,
    it doesn't 'hear' the escape key action. Well, the important point really
    is that you can replace the entire preview form with one of your own, with a
    TppCustomPreview or TppPreview descendent, allowing you to create all of the
    controls and configure them to work any way that you want. You can also
    register a different preview form for each report, if you really
    needed/wanted to. One customer I know of has one preview form which is
    normal, and another one which overrides the print button action so that he
    can call his special escape code sequences to print to dot matrix printers
    in a custom format, instead of using a print driver.

    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited March 2002
    Hi there, I tried using the code below, and it didn't work for me. Tracing
    through, I found that "Report1.PreviewForm" was nil, so it blew up with a
    catastrophic failure :)

    I'm pretty sure that it's because I'm creating everything at run-time, I
    don't have a TppReport object created at design time. So, how can I get the
    code below to work, when it doesn't appear that I have a
    "Report.PreviewForm" ??

    I'm using RB 6.02 Professional.

    Thanks,
    Mike.


  • edited March 2002
    You need to use the Report.OnPreviewFormCreate event, because the preview
    form is not created until you choose to preview the report to the screen.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited March 2002
    Hmm, I tried defining an OnPreviewFormCreate event and assigned the event at
    runtime, but as soon as it tried to run it, it crashed (I had a breakpoint
    on the first line in OnPreviewFormCreate, and it never reached it).

    I'm surmising that this is because I don't have a TForm? (Everything is
    bundled up into a DLL, with no Form). I've been scanning this group, and
    have seen several references to using RB without a Form - I suspect this is
    the problem. I'll try adding a form to the project, and just not displaying
    it, and see if that helps.

    Thanks,
    Mike.

  • edited March 2002
    Jim, i think it's a good idea to create two new properties of the report:
    WindowState and ZoomSetting.
    It'll be very useful for all of us. (Or at least change the default behaviour
    of the reports. Almost all of us need them maximized and zoomed at 100%).
    Thanks

  • edited March 2002
    Ok, thanks for the suggestion.


    Cheers,

    Jim Bennett
    Digital Metaphors

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

    The problem lies originally in PPPREVIEW.PAS, the Preview Form unit.
    With Modal Forms like Preview, I don't see any apparent reason,
    why the Close button should be of type TSpeedButton.

    Suggested change:

    Change TSpeedButton to TButton:
    FBtnCancel: TSpeedButton; {The original row}
    --> FBtnCancel: TButton;

    Make BtnCancel the default Cancel button, so the Preview Form
    closes when pressing ESC.

    FBtnCancel := TSpeedButton.Create(FButtonBar); {The original row}
    --> FBtnCancel := TButton.Create(FButtonBar);
    --> FBtnCancel.Cancel:=True;

    With those three lines changed, the Preview Form will *always* close
    when you press the ESC key. This is one of the most standard behaviours
    of Modal Forms.

    I was able to easily fix thing when writing it straight to the RB
    unit. But I know this is no good way.

    I'm still looking a simple solution that would live at least the next
    3..5 years. I only want to have my reports ready, and don't want
    to start digging deep in to RB units, like I had to do with several
    QR bugs.

    Well, I never had to touch QR's preview form though:)

    -Barry
  • edited March 2002

  • edited March 2002
    Ok, copy our TppPreview class to a new unit and change the class name to
    TmyPreview. Change the button type, and then register this class as the
    previewer plug in that you want to use. Since this unit is in your project,
    when you upgrade to the next version of RB, you will not have to change
    anything, because your preview register call will still override the default
    registered preview plug in.

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.