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

Change VFP7 Report Form TextBox Properties 1

Status
Not open for further replies.

IForgot

Programmer
Mar 20, 2002
122
US
I want to find out if there is a way to programatically change the TextBox Properties of a Report Form.

My users want to BOLD the text in a Grid's single TextBox by clicking on some button. I don't think that this will be too hard by using DynamicFontBold and, at the same time, I should be able to save a referernce to that field for subsequent use.

But they then want to Print that record and have the Field value which they have BOLDed appear differently (BOLD Font and/or Shaded Background, or something) on the printed Report (via a Report Form).

I do not recall seeing anything similar to the Print When... which will allow me to programatically control the Font or the Background Color of an individual field's TextBox.

Any suggestions would be most welcome.

Thanks,
I_Forgot
 
By 'playing' around in the Report Form's table I have found one way to programatically change the Report TextBox's properties.

I can set new values into the specific TextBox's
FillRed
FillBlue
FillGreen

Or I could change the FontStyle to a 1 for BOLD

And then I could return the table value to its original setting after the report was printed.

But some problems might arise if another user wanted to print a different record using the same Report Form at the same time. If so their report would reflect the changes introduced by the first user and not show their own settings.

If someone has another approach I would welcome the advice and/or suggestion.

Thanks,
I_Forgot
 
Nope - The only way to currently do it, is to drop multiple Textboxes at the same place on the Report, Set each to use a different font, type or color, and then use Print Whens to control which one is actually used.

Based on some public statements about VFP 9.0, you should be able to do this much easier there. Till then, you may want to check out one of the third-party report addons or Crytal Reports to provide these capabilities.

Rick
 
I thought that I had this issue worked out, but now I am not so certain.

When I manually modify a Report Form's TextBox Fill Color throught Foxpro's Report Designer, I get what I want.

And the Report displays correctly in the Preview mode.

I then examine the Report Form's DBF (in reality the FRX file) to see where and how the changes are reflected in the table.

It appears as though the only changes are to the individual TextBox Record's FillGreen, FillBlue, & FillRed values.

Now I close the table and put everything back to the original non-modified settings.

On my next test I attempt to do the same thing programatically by:
1. Select a test TextBox
2. Open the Report Form's FRX table
3. Find the specific TextBox's record
4. Modify the associated FillGreen, FillBlue, & FillRed values
5. Close the table
6. Preview the Report Form

BUT the specific TextBox is now not showing the modified Fill Color.

On visual review of the record contents under both test conditions, no differences jump out at me.

Have I missed some other critical parameter?

I'd appreciate any insight you might have.

Thanks,
I_Forgot

 
Unless the current printer (driver) supports colors, it doesn't matter what those values are! Were you using the same printer both times?

Rick
 
On a side note, you may want to twiddle with a copy of the report form rather than the live one for a given user.
If the user wants to runt the report you could copy it or do a SELECT * ....READWRITE from that report form to a unique file name, update the settings as needed, then delete the temp report.
That way you preserve the integrity of the report and also allow other users to access it at the same time.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Rick - Yes it was the same printer each time.

My first test did not use any printer at all, but instead the Report Preview mode -- where the problem was first noticed in the different on-screen results.

I have also hacked the Report table's EXPR, TAG, & TAG2 memo fields to eliminate any of those 'inherited printer' issues.

And the HP Laser printer I am using does support the grayscale background shading colors being requested.

Dave - The way I am planning is that if/when needed the application will create a Local (temp) copy of the report onto the user's own PC from the central 'standard' report on the server. That Local copy will be modified as needed.

Each Grid record could have different TextBox FillColor requirements. So I only print a single record at a time.

When the print is requested I examine the record's needs, modify the Local Report table as needed, and then run the report by specifying use of the Local version.

After which I return the report table contents to their original values in preparation for the next record print.

My problem is that just modifying the FillRed, FillBlue, & FillGreen for a given record, for some reason, is not by itself working.

Again, when making the same changes in VFP7's Report Designer it works well. And subsequently examining the resultant changes to the Report table, I cannot see anything different.

Most likely there is some subtle parameter within the Report table which I am over-looking.

Any additional insight would be greatly appreciated.

Thanks,
I_Forgot
 
For the record - the report preview is ALWAYS based on a printer driver. If you haven't removed the tag information, it's based the printer that was current at the time the report was saved last. If you removed the printer information or in VFP 8.0 choose not to save it, then the preview will use the current printer selected - the VFP one if it''s different than the Windows default!

Rick
 
Thanks for your continued interest and replies.

Rick - I did not realize that the Preview also used a Print Driver. Since the Preview appears on-screen, it did not come to mind.

However in this particular instance, after writing the new FillRed, FillGreen, & FillBlue values, I do a LOCATE FOR ObjType = 1 to find Record #1 and then clear that record's Expr, Tag, & Tag2 memo fields to eliminate possible 'inherited printer' settings.

Also since my programatically modified test and my interactive manual test through VFP's Report Designer both used the same printer and print driver, it does not seem like a likely contributing factor.

Dave - Thanks for the FontStyle settings.

I am not changing the Font, merely coloring the Background with a light Gray Shade to make it stand out somewhat to the reader. All of the TextBox settings are consistently FontStyle = 1, before and after attempted Background Color changes.

When I did my manual test through the VFP7 Report Designer and examined the Report Table results, I did not see that the Font had been changed when I changed the Background Color - only the FillGreen, FillBlue, & FillRed fields.

Additional insights are most appreciated.

Thanks,
I_Forgot
 
But they then want to Print that record and have the Field value which they have BOLDed appear differently (BOLD Font and/or Shaded Background, or something) on the printed Report (via a Report Form).

I reckon I misunderstood.

Have you also changed the Transparent/Opaque setting?
The background color/shading won't happen if the textbox is transparent.
I believe the Mode field in the .frx needs to be 0.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Dave - you got it!!!

I did not see the Mode property changed when I tested this via VFP's Report Designer, but it was indeed the missing piece that made the Background Color show as intended.

Thanks,
I_Forgot
 
One last note.

I apologize for the confusion about originally considering either BOLD or Shaded.

After reviewing the document, I discovered that ALL TextBox fields were already Bolded so that eliminated that as a possible change option to draw the reader's attention to individually Marked Fields.

Thanks,
I_Forgot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top