[Gambas-devel] Printing
Rob
sourceforge-raindog2 at ...19...
Fri Nov 7 19:35:42 CET 2003
On Thursday 06 November 2003 20:59, Andrés Calderón J. wrote:
> I would like know if there is a way to print the content of a
> TextArea or at least how to print a string variable (Printer).
Well, for example, try putting this code in the click event of a
button marked "Print" (let's say you have a textarea named
TextArea1)
Printer.setup ' brings up print settings dialog
Draw.begin(Printer)
Draw.Text(TextArea1.Text,200,200)
Draw.end
This will kick out a page with the contents of the TextArea1
object. It seems to do odd things with blank lines though (like
omit them.... sometimes.) I just now updated the test wiki with
the above example.
I see a big flaw with how this works in that sometimes you may
want to interleave drawing on a printer and some other drawing
surface (like a DrawingArea you're using as part of a user
interface) but Draw.end causes the printer to kick out the page.
I'll probably write a PrintDocument class/library at some point
to buffer drawing events and let you print them whenever. I
also think I'd need a "Print" method to automatically keep track
of "cursor position" as with VB's "Printer.Print" (which itself
needs a lot of help.)
This question belonged on gambas-user hy the way, so if you have
any more questions let's continue it over there. gambas-devel
is to discuss changes to the inner workings of gambas itself.
Rob
More information about the Devel
mailing list