Alpha DevCon 2018
Results 1 to 11 of 11

Thread: Preview report from xdialog

  1. #1
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,298

    Default Preview report from xdialog

    I have a print button in my modal dialog box that previews a report layout. My problem is that the preview pops up behind the dialog box and I can't shift focus to the preview in order to print the report.

    I've experimented with using a modeless dialog box, and have the same problem.

    The only way I've found to do this is to make the dialog box modeless and then use the print button to minimize the dialog box. However, after I dismiss the preview or print the report I cannot "restore" the dialog box to it's original location and size. My only option is to maximize it, which then fills the entire Alpha Five window.

    So, how do folks do this?

    I'd like to be able to preview/print a saved report layout from a dialog box, and when the report is finished I'd like the dialog box to automatically regain focus in its original location and size.

    Is this possible?

    Thanks.

    -- tom

  2. #2
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default Re: Preview report from xdialog

    Geesh Tom, if you can't figure it out, what makes you think we can? LOL

    Why not close your dialog box when they select the print button and then use the OnPrintExit event of the report to re-open the dialog?
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  3. #3
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,298

    Default Re: Preview report from xdialog

    Good morning, Cheryl.

    Your idea is promising. I'll give it a try and let you know.

    To teach myself more xdialog this summer I decided to try to build a dialog box to manage a Phone_log table. Simple table, just to track incoming phone messages, and mark off those that have been handled. The dialog needed to be able to navigate through the table, and do the usual maintenance chores (enter, delete, edit). It needs to be able to run on a LAN with multiple users throwing records at it. I have the basic dialog almost finished. Now I'm adding "extras" like, print the current log entry. Later I hope to add other features that will permit me to change the sort sequence, do find by keys, print other reports, etc. Who knows, if the editors are interested it might turn up in the newsletter one day.

    Anyway, thanks for the suggestion. It may work, but I'd have to figure out some way to navigate to the record that just printed when the dialog opens the second time.... Otherwise, the user will have to navigate to it manually.

    -- tom

  4. #4
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default Re: Preview report from xdialog

    Tom,

    Capture the value of your records unique field in the OnPush of the print button and then use that variable to query the table when re-opening the dialog from the report event.

    Sounds like a cool program. You will have to let me know how it ends up.
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  5. #5
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,784

    Default Re: Preview report from xdialog

    As a variation on Cheryl's idea.

    Quote modified. Mods in bold.
    Why not Hide your dialog box when they select the print button and then use the OnPrintExit event of the report to show the dialog?PM
    UI_DLG_HIDE()

    Edit:
    Not sure if you're using the PREVIEW_REPORT() function but just noticed it has a couple of 'Modal' paramaters that may be of some help.
    Last edited by Tim Kiebert; 08-08-2006 at 08:59 AM.
    Tim Kiebert
    Geelong Citrus Packers
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  6. #6
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default Re: Preview report from xdialog

    Tim's idea looks a lot easier than mine :)
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  7. #7
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,784

    Default Re: Preview report from xdialog

    Now, if only it works. :)
    Tim Kiebert
    Geelong Citrus Packers
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  8. #8
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,298

    Default Re: Preview report from xdialog

    Thanks Tim & Cheryl. The optional modal and session_modal parameters did the trick. Here's the code for the Print button:

    Code:
        Case a_dlg_button = "Print"
        	'can only happen if rec is not dirty
    	preview_report("One_msg","Callnum = "+quote(rec.callnum),"",.t.,.t.)
        	a_dlg_button = ""
    The report is named "One_msg".
    Callnum is an autoinc identifier field (C, 5) in the table.
    Rec.callnum is a dot variable which contains the current phone call number.

    thanks again.

    -- tom

  9. #9
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default Re: Preview report from xdialog

    Very nicely done and cleaner than mine or Tim's idea. You get 10 gold stars for that one!
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  10. #10
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,784

    Default Re: Preview report from xdialog

    Cool. Glad you got it to work. I am slowly building a 'how to' file from things gleaned from the forum. This will be another entry.
    Tim Kiebert
    Geelong Citrus Packers
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  11. #11
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default Re: Preview report from xdialog

    I am slowly building a 'how to' file from things gleaned from the forum.
    Can I get a copy, please, please, please :)
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

Similar Threads

  1. Report Preview
    By Robert Adler in forum Alpha Five Version 6
    Replies: 0
    Last Post: 12-05-2004, 02:58 PM
  2. Can't preview report
    By Ohlen Cartmell in forum Alpha Five Version 5
    Replies: 0
    Last Post: 01-05-2004, 05:44 AM
  3. Preview Report
    By Scott Rusoff in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-01-2003, 08:41 AM
  4. report print preview
    By Neil Terry in forum Alpha Five Version 4
    Replies: 7
    Last Post: 10-13-2001, 01:36 AM
  5. Report Preview
    By Arthur Casse in forum Alpha Five Version 4
    Replies: 5
    Last Post: 09-30-2000, 06:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •