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!

Can a field object in VFP Report writer be resized automatically?

Status
Not open for further replies.

A Beginner

Programmer
Apr 15, 2017
81
IN
I want to make a generalized program for preparing frx for an AskInGrid. The grid has 2 columns- Colname and Colvalue.
As columns may be large or small, I want the field object to be resized automatically.
The stretch and overflow property resizes the object's height but I want to resize object's width. Is it possible in the frx?
 
I would intervene you implementing that idea even leaving aside the technical abilities or inabilities of report fields.

When the width autogrows that would make the Colname column width the max width of any item in it, wouldn't it? So it leaves the rest of a page for the Colvalue column. Is that really a favorable layout?
Or do you want to allow ragged alignment?

If you don't allow height overflow, the clipping option will determine, whether text is clipped or overflows the field width. I'd have to experiment with reports to see if and how that would shift line objects.

Isn't it that way, that only a max width makes sense? And that's the width you can set a field to, after reaching that width the fields will only strech down, yes, that's the only "endless" direction, of course on multiple pages, but there is no endless space to the right or left, that's one page width, portrait or landscape. You might find it easier to layout what you want in a landscape report.

Bye, Olaf.
 
Fine, I also use it to change the font size of report elements on the fly. But it's also a bit of acting as sorcerers apprentice using this, especially for a beginner, I wouldn't deep dive into the inner workings of FRX data.

You still didn't answer, whether you want to allow ragged alignment or not. You now indirectly answer that. The FRX only has one record for the report element, so you have one width for all rows. This still does not answer what width you'd want. If even max page width won't fit all values, you have to use some width and rely on word wrap anyway, and then what looks best is nothing you can really compute. If only one word of one row wraps, it will be better to make the column much narrower so word wrapping occurs in a more natural look. Also, one long value fitting will look odd, if all other values are shorter. So even in case all things will fit in single rows, narrowing a column to let most of it's text word wrap can look better.

With that in mind, the best thing would be to let users lay that out themselves because this is about what pleases the eye, less computable. Notice MODIFY REPORT can also be done at runtime, you can give users control over the report and modify it to their current need, also read about PROTECTED mode and what you can allow and disallow users to change in the FRX, that's pretty clever.

Bye, Olaf.
 
I what I did is as follows_
1. Run the program which run the form having askingrid.
2. The grid's width and no of rows is as per data in its record source cursor. I calculated the width using thsform.grdrra1.column1.width, thsform.grdrra1.column2.width and saved them in 2 variables.
3. On Ctrl+p Called procedure from keypress event which in turn passing 3 parameters i. Grid's record source (cursor) alias in a variable,ii. width1 and width2 called the program (askingridprint.prg)which I had coded to drive the frx.
4. Before creating driving cursor for frx copied the frx from &frxpath\askingridprint.f* to the workpath using
'copy to &workpath\Tmpaskingridprint.f* command in the last program(askingridprint.prg).
5. In the Field properties->others->Edit user data I had entered the control's name before hand. I calculated Left and width of all report objects (using width1 and width2)on the frx.
6. Now used Tmpaskingridprint.frx and replaced HPOS field with left values and Width with width values for upper(User)= 'Names entered in user data in upper case'
7. Now created driving cursor for the frx using reccord source cursor of thje grid and used Report form command to preview the modified frx.
 
OK, now I assume you make the grid columns resizable, giving users a way to influence the form grid looks and thereby affecting the report layout.

Just notice width in pixels vs FRU (FoxPro report units) needs a conversion factor. 1 FRU = 1/10000 inch, much higher resolution than any printer supports, so very theoretical but also pretty future proof.

You might make up any conversion factor of your liking, as the print does not necessarily need to reflect the screen size grid, so there is no point in printing each 96 screen pixels (1 inch) in 1-inch on the paper, but fit the grid width to paper width with an overall factor of paperwidth/gridwidth converted to inches, each. Anyway, 1/10000 inch is a value you have to know for that matter and it's not simply 96dpi to 10000dpi conversion to get paper width fit. Font size adjustment to get the screen look transferred is yet another matter.

A minor criticism: Don't use macro substitution for paths when they potentially can contain spaces:
Code:
COPY (AddBS(frxpath)+"askingridprint.f*") TO (AddBS(workpath)+"Tmpaksingridprint.f*")

Bye, Olaf.
 
I calculated by speculation that 1 pixel = 104.6667 FRU and used it directly
Thank you for the minor criticism ... I shall Keep it in mind.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top