Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to know if FoxyPreviewer is active or not? 2

Status
Not open for further replies.

Rajesh Karunakaran

Programmer
Sep 29, 2016
549
MU
Hi Friends,

How do we check if FoxyPreviewer is active or not?

I.e., if I have already issued the command 'DO FoxyPreviewer.app' somewhere earlier in the code. My requirement is that I activate it before my call to REPORT FORM... and after the print I need to turn it off. I know I can do that by 'DO FoxyPreviewer.app WITH "Release".

However, I want to check in my code whether FoxyPreviewer is already active and if yes, I will not disturb that enviro when I return from my code. How do we achieve that ?

Thanks in advance,
Rajesh
 
Hi Rajesh,

Are you sure you need to activate FoxyPreviewer every time you run a report, and then de-activate it afterwards? Most of the time, you can just [tt]DO FoxyPreviewer.app[/tt] at the start of the session, and release it when you are ready to quit.

If you want to temporarily switch it off (for example, if you want to run some of your reports without FoxyPreviewer), you can [tt]SET REPORTBEHAVIOR 80[/tt] to disable it, and then [tt]SET REPORTBEHAVIOR 90[/tt] to re-enable it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Hope you and family keep fine! Thanks for your immediate response.

Yes, I can switch it on once at start up. But, my requirement is different. If I write a code for my client on a single module, chances are there the Calling Program (which might have written by someone else and I have not seen it) might have activated FoxyPreviewer within it before the call. Too, it may expect FoxyPreviewer to be still active after my code returns. In such a case, I would not want to (rather I should not) deactivate it from my code (for obvious reasons) which could break the Calling Program. But for that I need to check FoxyPreviewer status. But, how?

Now, as per your suggestion, it seems there is this alternative of setting the REPORTBEHAVIOR 80 instead of worrying about the FoxyPreviewer status (whether it's active or not at the moment). Am I on the right track ?

Rajesh

EDIT: I just checked it. When I do 'DO foxypreviewer.app', the REPORTBEHAVIOR turns 90 automatically. When I do 'DO foxypreviewer.app WITH "Release", the REPORTBEHAVIOR turns back to 80 automatically unconditionally. Even if my earlier status was REPORTBEHAVIOR 90, it becomes 80. So, I can check REPORTBEHAVIOR status it seems. Let me see..

Thank you Mike!
 
Well, foxypreviwer establishes an object _Screen.oFoxyPreviewer

That's how you detect it's running and in that case you might rely on it being preconfigured as the customer or the third party developer needs or wants it, use it as is, and don't release it.

When you look into the documentation you find this object mentioned and in "advanced" use you can use intellisense on this object in your own programming to set some features in this object. If you don't know it you miss out a lot of options.





Chriss
 
Chriss,

Thank you very much!
Yes, this is exactly what I am looking for!

I have read about _Screen.oFoxyPreviewer but as I am not really using most of its features (other than PDF, HTML outputs etc), this object was not in my mind. Now, I really need to use them, say, taking off a few buttons from the toolbar, activating PDF in 'Save File As' menu etc etc. So, I will certainly try to check this.

Rajesh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top