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

Hack FRX on the fly?

Status
Not open for further replies.

jimstarr

Programmer
Feb 6, 2001
975
US
On a report (VFP9) containing some graphics I need to be able to print a thin vertical rectangle with its height and vertical position calculated at run time.

Can I hack the frx at run time within an exe?

Is there a better way to do this?

Thanks!
Jim
 
Jim,

Have a look at Doug Hennig's reply to thread1252-1518728. This will tell you how to find the FRX elements that you need to alter.

As far as hacking the FRX within an EXE is concerned, you can use COPY FILE to copy the FRX (and its associated FRT) to temporary physical files, and then REPORT FORM from there.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
In my app's (EXE) I use a generic method of hacking the frx to enable the users to easy adjust left or top margins.
That works fine.
If you are interested I can provide sample.
-Bart
 
Thanks, Bart, I'd like to see your sample. -Jim
 
Jim,
Is there a way how I can provide you with this class?
Should be most easy as I have it in visual class format.
Copying the code in here is not easy.
-Bart
 
Bart, I'd rather not do it by email, so let's skip the code sample.

I see how to hack the copy of the frx, no problem. How to make sure it gets deleted? Is it possible to run REPORT FORM where the frx is a cursor?

Jim
 
Jim,
As you know the report is normal VFP table.
While treating as a normal table I do copy the report to a temp table but with frx/frt extensions.
Than next code does the job.
For me this does the job knowing that I only deal with the objects as treated. No pictures etc. But that might be added in an easy way I presume.
Simply delete the temp.frx afterwards in clean-up code.
-Bart
Code:
IF This.Topmargin<>0 
  replace all Vpos with Vpos+This.TopMargin*3940 for objtype=8 						&& rep field
  replace all Vpos with Vpos+This.TopMargin*3940 for objtype=6 						&& line
  replace all Vpos with Vpos+This.TopMargin*3940 for objtype=5 						&& text
  replace all Vpos with Vpos+This.TopMargin*3940 for objtype=9 and objcode=4 		&&band-info
  replace all height with height+This.TopMargin*3940 for objtype=9 and objcode=1	&&3950 = 1cm
  replace all Vpos with 0 for objtype=9 and objcode=4								&&3950 = 1cm

ENDIF

IF This.Leftmargin<>0 
  replace all Hpos with Hpos+This.LeftMargin*3940 for objtype=8 					&& rep field
  replace all Hpos with Hpos+This.LeftMargin*3940 for objtype=6 					&& line
  replace all Hpos with Hpos+This.LeftMargin*3940 for objtype=5 					&& text
  replace all Hpos with Hpos+This.LeftMargin*3940 for objtype=9 and objcode=4 		&&band-info
ENDIF
 
I also routinely hack the FRX as described above and offer the user a pick list of columns (fields) where they can choose what to print. When the report is run I move all the columns, headings, and any summations to the left leaving a pre determined amount of space between columns. I also adjust the width of any lines and background shading on alternate rows. This also allows me to put more columns on the report than can fit in the page width with some of the columns set as "No Print" in the FRX itself.

Auguy
Northwest Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top