Alpha DevCon 2018
Results 1 to 18 of 18

Thread: Xdialog and Print Preview

  1. #1
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Xdialog and Print Preview

    I have several XD's now that I use for searches and opening forms, so I decided to try one for selecting reports to preview. I made it modeless with a rollup feature, which works fine EXCEPT I lose focus on the XD when the preview window is opened. Once the preview window is closed I can access the XD again.

    Has anyone else noticed this behavior - or is it just me?

    I should mention that the red X will close the dialog while the preview is open, but nothing else is accessible.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

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

    Default Re: Xdialog and Print Preview

    Hi Robin,

    See if setting the 'session modal' parameter to false makes a difference for you. Its default is true. That means you have to set the preceding parameters so set 'modal' to false which is its default.
    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.

  3. #3
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    Hi Tim,
    Where are those settings found?
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

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

    Default Re: Xdialog and Print Preview

    Oops sorry, I assumed (bad idea I know) that you were using report.preview(). Its the fifth parameter in that function.
    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.

  5. #5
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    I'll check it out, since I am calling that function from my XD.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  6. #6
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    Defining the additional parameters for report.preview() works great.

    Now I am trying to add a filter_expression box so the user can create a filter expression for the selected report based on its primary table. I can get the table name fine if it is not a set - but how do I get the primary table name if the report is based on a set?

    Surely there is already a function for this...?

    Edit: I'm trying too hard as usual - there is a parameter right in a5_get_filter() that if set to .t. will display the tables in a set.

    go figure...
    Last edited by MoGrace; 10-04-2015 at 04:00 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  7. #7
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    My finished script - add your own tables or sets to test.
    RepList_10-04-2015.txt
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  8. #8
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,019

    Default Re: Xdialog and Print Preview

    Hi Robin,

    but how do I get the primary table name if the report is based on a set?
    Not sure that why do you need the primary table in order to show the report list?
    Code:
    'Report Search Option
    vSearch ="customer"
    if vSearch ="Customer" then
    	tblist ="customer.dbf"
    'else if vSearch ="other" 
    	'tblist ="other table dbf name	
    end if
    a_repname = a5enum("report",alltrim(tblist))
    'It will be focused on the preview, the preview will be on top of the your dialog.
    Code:
    if a_dlg_button = "ev_Prev" then
    	if vfltr = "" then
    		vfltr = ".t."
    	end if
    	:report.preview(repname,vfltr,"",.t.,.f.)	
    	'Tln("Preview Report",repname,"USER")
           msgbox("just exist from preview") 'I gave up that How to find the "Preview" is opened or closed stage. 
    end if

  9. #9
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    Hi John,
    Did you take a look at my script? My modeless XD does not disappear when the preview window opens and I did resolve how to close the preview from the XD.

    :report.preview(repname,vfltr,"",.f.,.f.) keeps the XD from losing focus.

    Although if the same report is previewed again while the 1st is open, my close button doesn't close the 2nd report...

    Eventually this script is going to be used in a supercontrol, so that won't be an issue. This version is called from my toolbox menu.
    Last edited by MoGrace; 10-05-2015 at 10:47 AM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  10. #10
    "Certified" Alphaholic
    Real Name
    Thomas Patten
    Join Date
    Apr 2000
    Location
    Duluth, MN
    Posts
    1,455

    Default Re: Xdialog and Print Preview

    Robin,

    I like this, but want to manually enter the reports rather than show ALL the reports for a table or set. How should I edit your script to accomplish this?

    TIA - Tom

  11. #11
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,995

    Default Re: Xdialog and Print Preview

    auto_list_repname = a5enum("report",alltrim(tblist))

    a5enum("report",alltrim(tblist)) creates a crlf() delimited list of reports. If you create a crlf() list of your own and point auto_list_rename to that list you should have it.

    auto_list_repname = my_list_of_reports_variable

    instead.
    There can be only one.

  12. #12
    "Certified" Alphaholic
    Real Name
    Thomas Patten
    Join Date
    Apr 2000
    Location
    Duluth, MN
    Posts
    1,455

    Default Re: Xdialog and Print Preview

    I used then tblist variable and it worked like a charm. Thanks ~ Tom

  13. #13
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,995

    Default Re: Xdialog and Print Preview

    Makes sense. You could have a table of report names and get them into a list with table.external_record_content_get(), for example. Doing that allows you to change the available reports by managing the table instead of modifying the xdialog code.
    There can be only one.

  14. #14
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    Stan,
    That is what I am doing as well. In the table I have added a group field that I use in a tree on the preview supercontrol. In that script, instead of calling report.preview, I reset the filter for the SC.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  15. #15
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    I am changing my RepList() function to display a tree instead of a list and am trying to use a button to close the currently active report preview window. The script below works well enough on the last preview window but needs to be refreshed somehow after the current window closes in case 2 or more reports were previewed.

    Code:
    if a_dlg_button ="ev_exitprev" then
    	openlist = a5_list_open_windows()
    	vlist = crlf_to_comma(openlist) 
    	windowname = object_name_normalize(vTree) 'refers to last report only
    	windowname = "Preview__"+windowname
    	if inlist2(windowname,vlist)
    		cmd = windowname+".close()"
    		evaluate_template(cmd)
    	end if
    end if
    I have another button that calls the actual report.preview() and am thinking that maybe that event ought to build the openlist and vlist variables. Then if more than one report was called the list would have more than one report... Does this make sense?

    Maybe something like a *for_each or for...next except that I want the button to close the current report with each push not all of them (maybe another button could do that...)

    Any ideas?

    Edit:

    Perhaps I could add a small listbox to show a list of the selected reports, because when I clicked on the report name again regardless of whether it was the current report or not, the button did close the selection.
    Last edited by MoGrace; 11-29-2015 at 07:36 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  16. #16
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,995

    Default Re: Xdialog and Print Preview

    Once a window (preview or other) is closed it should no longer appear in a5_list_open_windows(). Not sure why you're having a problem.
    There can be only one.

  17. #17
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    Clicking on the report in the tree again does set the vTree var so if open the button should find it. But the list of reports can be very long, and the user may not remember which report he is viewing. So the 2nd list seemed like a good idea.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  18. #18
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,397

    Default Re: Xdialog and Print Preview

    Another anomaly to consider. If you call preview_report() from an xd with the session modal flag set to false, this allows the xd to close properly. However, if that report has a button to open a popup form, the popup form will not close when you exit the preview window using the OnPrintExit event to close the form (which works only if the session modal flag is true).

    So something to consider: either the user will have to close the xd or the form - because you will not be able to auto close them both!

    Another note to myself...
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

Similar Threads

  1. Closing the Print Preview after pressing the Print button
    By and13345 in forum Alpha Five Version 11 - Desktop Applications
    Replies: 6
    Last Post: 02-11-2013, 01:20 PM
  2. xdialog and print preview
    By crimmelcp in forum Alpha Five Version 10 - Desktop Applications
    Replies: 1
    Last Post: 09-02-2010, 03:29 PM
  3. Preview report from xdialog
    By Tom Cone Jr in forum Alpha Five Version 7
    Replies: 10
    Last Post: 08-08-2006, 06:57 PM
  4. Print Preview
    By Ed Barley in forum Alpha Five Version 6
    Replies: 10
    Last Post: 09-15-2005, 06:09 PM
  5. Print preview
    By Ales SKlepic in forum Alpha Five Version 4
    Replies: 2
    Last Post: 01-15-2001, 04:12 AM

Bookmarks

Posting Permissions

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