INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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?

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

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.

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

(OP)
Cathy Pountny's book on vfp report writer
https://www.scribd.com/document/251958515/VFP-Repo...
has solution to this question.
In Chapter 11: Hacking the FRX she describes how to use the frx as vfp table.
There is a width colunm which can be interpreted through program.

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

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.

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

(OP)
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.

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

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.

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

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close