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 gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display report in max window 1

Status
Not open for further replies.

wtotten

IS-IT--Management
Apr 10, 2002
181
US
I have VFP 8. I report I run from a form and it always shows in a small window ("normal size" not "maximized").

REPORT FORM myreport PREVIEW

How can I get it to display full-size?

Thanks,
Bill
 
Hi

1. I have to disagree with Mike on the code.
KEYBOARD '{CTRL+F10}'
REPORT FORM myreport PREVIEW
This will not work, if the code iss from a forms print report button for example. KEYBOARD effect will get first executed with relevance to the container on which it is placed and the report form will get fired after that.

2. The following code will work..

oRepForm = CREATEOBJECT("FORM")
WITH oRepForm
.Caption = "Your Report"
.WindowState = 2
.Show()
ENDWITH
REPORT FORM rptFrxFile PREVIEW WINDOW (oRepForm.Name) ;
TO PRINTER PROMPT
oRepForm.Release()
RELEASE oRepForm


OR

3. More detailed way of solving it..

oRepForm = CREATEOBJECT("FORMPREVIEW")
WITH oRepForm
.Caption = "Your Report"
.WindowState = 2
.Show()
ENDWITH
REPORT FORM rptFrxFile PREVIEW WINDOW (oRepForm.Name) ;
TO PRINTER PROMPT
oRepForm.Release()
RELEASE oRepForm
**********************************

Make sure that the following is added at the end of your Main.prg or suitably so that the class is available for the aboce code.
**********************************
DEFINE CLASS formpreview AS form
ShowWindow = 1
DoCreate = .T.
Caption = "Form"
TitleBar = 1
WindowState = 2
Name = "formpreview"
ENDDEFINE
**********************************


____________________________________________
ramani - (Subramanian.G) :)
 
wtotten

This being FoxPro, there are many ways to achieve something. Another solution would be:

In the init() of the Dataenvironment of the report

Code:
ZOOM WINDOW 'Report Designer' MAX

N.B. This is language specific. 'Report Designer' might be different if your are using a non-english version of FoxPro.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Ramani,

I have to disagree with Mike ... This will not work, if the code iss from a forms print report button for example

I can't see what different that would make. The KEYBOARD command stuffs the Ctrl+F10 in the keyboard buffer, from where it can be retrieved by the first process that requests it. It doesn't matter where the code is called from -- at least, not as far as I can see.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
MikeLewis

I believe I have used your suggestion in the past, where a report was called from a form and the form was the one being maximized not the report.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mgagnon and Ramani,

Well, I'd be prepared to admit I'm wrong, but, you know, I just tried my code again, and it worked as expected. It correctly maximised the preview window, not the calling form. I called the code from the click event of a button on the form. This was in both VFP 7.0 and 8.0.

Am I missing something?

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 

Mike

Am I missing something?

I don't remember the exact instance, I haven't that technique in a while, perhaps a datasession?


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

Am I missing something?

If resource is on ctl - F10 will toggle. So if you have resource on you need to save the current resource, set resource off, KEYBOARD '{CTRL+F10}', and then restore the resource.

Regards,

Mike

 
Thanks everyone for your help. I tried the simple suggestion from Mike Lewis first and it worked.

Bill
 
Mspratt,

If resource is on ctl - F10 will toggle. So if you have resource on you need to save the current resource, set resource off, KEYBOARD '{CTRL+F10}', and then restore the resource.

Hmmm. I just tried that. It worked the same, regardelss of the setting.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi Mike,

It worked the same, regardelss of the setting.

I mostly use ZOOM WINDOW "Report Designer" MAX in the report's DE.init, but when I was trying KEYBOARD '{CTRL+F10}'I noticed the behavior. It may be that it "toggles' in the compiled app with RESOURCE ON.

Regards,

Mike
 
Just tagging on the end of this thread.

Sometime ago, mgagnon (Mike) suggested the following:
Code:
ZOOM WINDOW 'Report Designer' MAX
which solved my problem perfectly

And to MikeLewis (Mike)
Code:
KEYBOARD '{CTRL+F10}'
REPORT FORM myreport PREVIEW
works perfectly too!

(If it helps)
Lee

Alone we can do so little, together we can do so much
(VisFox Version 6 User)
 
Hi MikeLewis,

Sorry I could not get back fast.

Your code works in normal circumstances.
And Mike Gagnon's confirmation is also right that under some circumstance it failed. That I also confirm that it does not work in some settings. But I am unable to reproduce immediately, because, I have taken a different approach. I will report if I could find where it failed.

I need to recompile my application by using it where it surely failed. But I have to identify why and until then I cannot say anything. The way I use it is that it follows 'on the fly report creation' from a table I have used for the report fields.. a mother of tables for all the .frx file. I dont even distribute .frx files, but instead use a table storing all the frx content.. then always extract it from the table and creating a temp report file on the fly with the paper/printer/orientation etc settings and then run the report using that report file.. that is a bit elobarate. But I do generate using report designer and then run my tool which extracts and updates that reports table as the project gets compiled.

Now with VFP9 I have to even think more on these. MS has done a lot in this area which I was servicing using my code/table. :)


____________________________________________
ramani - (Subramanian.G) :)
 
Hi Ramani,

Thanks for those comments.

I will report if I could find where it failed

It would be interesting to know that, but don't go to a lot of trouble.

I like your idea of using a normal table to store the FRX "template". That way, you can skip any fields that are not relevant to your reports, and you have more control over field names and the like.

I find I use VFP for reporting less and less. Many of my clients want me to use Crystal Reports for reporting. That might change with VFP 9.0, if the new reporting features are good as they sound.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top