Printing a Graph drawn in a picture control ?

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Printing a Graph drawn in a picture control ?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:11 pm

by Silver Springs... >> Mon, 14 Dec 1998 21:28:55 GMT

Hi JADErs,
I have been using graph code filched from the JADE Advanced Course schemas for producing nice bar graphs. They make use of a separate class called Bargraph and the actual graph is drawn using a method called draw provided in the Bargraph class and output into a standard picture control on a form.

Once all the variables have been set up then its simply a case of executing myBargraph.draw(pic_bargraph) to have the picture control on a screen form filled with the generated graph.

This works fine -- but now I want to print the generated graph and its not working as expected. I changed the code to work with a report form with a picture control in a report frame.

I didn't think that filling the picture control would have to change and so it compiles fine and runs fine -- but when I execute my app.printer(frm_graph) --- then on Preview it displays the report with the header and just an empty frame i.e. it went thru the motions of populating the picture control -- but doesn't seem to display in Preview (and not on the printed copy).

If I change the app.printer.print(testform.frm_graph); statement to a testform.showModal then this shows the report form on screen with the generated picture in the displayed report. This proves that the picture control is filled correctly at the time --- but when I try to use the print statement the report is produced but with nothing inside the frame.

Has anyone come across this and so I was wondering if there are any additional tricks to getting a picture control filled with a generated graph and printing it ??? It may be a property of the Printer class that I need to attend to ?

RSVP ASAP TIA AJT .................
Alan J.Thomson
ph...Auckland 09-277-7961 x 744
http://home.clear.net.nz/pages/athomson

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Printing a Graph drawn in a picture control -- SOLVED?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:11 pm

by Silver Springs... >> Mon, 14 Dec 1998 22:23:17 GMT

Hi
I have resolved this situation. Turns out to be a problem with using the PrintPreview option.

I always prepare my reports and issue a app.printer.printPreview := true; --- so that the report is output to the screen and then the user can decide whether to proceed and create a hard copy or not.

With picture controls the PrintPreview feature uses a cloning technique that cannot handle redrawing the calculated contents of a picture control. It's not a simple matter to fix -- so for now you just have to do without the PrintPreview facility when printing reports of this type.

IOW -- print direct to the printer and ensure you've got app.printer.printPreview := false; set and your graph will print out sweet as .....

This bug has been submitted to the plant and may be fixed in a future release.

Alan (sigh .....)


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 0 guests