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

Using ? to print in color 3

Status
Not open for further replies.

kamweng

Programmer
Jan 20, 2012
36
MY
I am an amateur programmer and have learned a lot from this forum. I know I should use the report writer but I am used to hard coding the receipts. Please teach me how to print certain text in color (beside black) using the “?” command. I did searched this forum and FAQ but couldn’t find the solution. I am using an inkjet printer. Thank you.
 
Please teach me how to print certain text in color (beside black) using the “?” command.

The '?' command has NO means of controlling the print out color.
I guess that you could issue 'raw' Printer Commands to change the color immediately prior to your data output and then use the same methodology to change the print color back when done.

But, despite your merely wanting to do things the way you are used to doing them, trying to do it this way is not the way to proceed.

You have not stated whether you are using a version of Visual Foxpro or one of the OLD non-Visual versions of Foxpro.

If Visual Foxpro, then you would most likely no longer attempt to output to a printer using the '?' command.

Due to the basic nature of this question, at the risk of offending you (which I most seriously have no intent to do so), I might suggest that you spend some time going over the various free on-line VFP tutorial videos at:

Perhaps the following might be of specific interest to you on this topic.
Basic Reporting - Pt. 1
Basic Reporting - Pt. 2

Good Luck,
JRB-Bldr
 
One reason to still encourage "?" is, that you talk of a receipts.

You may talk about sepcific POS systems for cachiers with receipt printer, that are very special and will most probably not offer a windows printer driver, to which you can print an FRX report.

Nevertheless you'd need a handbook of the sepicifc printer to know the raw command chars to send for changing color. If there is an industry standard for POS systems, I don't know it. It surely isn't GDI or Postscript.

I may also be wrong and todays POS systems also run with standard printer drivers, but that would be what you need to make use of VFPs FRX options to print colored text.

Bye, Olaf.

 
Thank you for enlighten me. I took the easier way out by sticking to the old 2.6 foxpro method in doing reports. Now I see the needs to make use of the FRX.
 
The question only is, if your printer comes with a windows printer driver.
 
Yes, it has windows printer driver. My laziness in learning to master the FRX.

I have seen the on-line VFP tutorial videos as suggested by JRB-Bldr. Will now try to redo the reports via the FRX.

My first step is to find the place where I can execute the conditional printing like "DO CASE/ENDCASE" and "IF/ENDIF".

Thanks for your help.
 
When you place an object on the report designer (a bit of text, a line or a box), you can right click on it to get
it's properties - within there you will find a 'print when' feature that you can use for conditional printing

Good luck

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Besides the PrintWhen you can print expressions like IIF(booleantestexpression,valueforTRUE, valueforWRONG) and VFP9 offers ICASE(), read about it in the help, in shor it helps simplify nested IIFs.

Also you can call a function or method as the expression to print and thereby add logic and code to reports.

Also interesting could be the property "Remove Line If Blank". If all report objects are blank or no printed due to PrentWhen condition being false, the whole line can be removed.

Besides you have the reportlistener class to write code reacting to report events such rendering of a report object:
In an extreme case you can put your report logic in there and use report objects just for a rough layout to trigger the render event to draw or write whatever you want. It helps to know GDI+ for that matter or use GDIPulsX from Codeplex VFPX Project.

Bye, Olaf.
 
My first step is to find the place where I can execute the conditional printing like "DO CASE/ENDCASE" and "IF/ENDIF".

Remember that the VFP Report Forms are 'run' by using a 'data source' - a data table or data cursor.

Code:
SELECT ReportData  && The Report Form's data 'source'
REPORT FORM MyReport NOCONSOLE TO PRINT

With that in mind you might want to incorporate your DO CASE/ENDCASE and IF/ENDIF into the building/populating of the report's data source prior to running the REPORT FORM command.

Good Luck,
JRB-Bldr
 
Thank you for all your guidances, especially the ICASE()command! This is the first time I heard of it.

In fact, I learned how to program from this forum and the VFP help file.
 
I would like to thank all of you who have helped me in creating the frx. Your wisdom and patience are priceless.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top