[Gambas-user] Paint.Begin(<object>) and printer.print

Rolf-Werner Eilert eilert-sprachen at ...221...
Wed Jan 9 08:59:05 CET 2013



Am 08.01.2013 22:46, schrieb Karl Reinl:
> Salut,
>
> is that logical?
> For Paint.Begin(<object>) I need a device object.
> But if i start a printer with .print, Paint hijacks the printer as
> device.
> Had some day with blanc pages, while  setting Paint.Begin(<printer>) in
> printer_Begin().
> What worked when project is started as executable, but not when used as
> library.
>

Salut Karl,

This has caused me some headache before I finally understood that the 
printer thing now runs completely in its own event loop, but graphics do 
not.

As far as I understand the mechanism, for graphics you still need to 
point to a device and Paint (or Draw) into it. So you have to define a 
Begin and End for it within your code. For printers, you simply set the 
defaults and then start the event loop by saying Printer.Start. The 
event loop will then touch the appropriate parts in the code by itself.

This cleans up code, but it requires you to keep track of the page you 
are currently in so you can print each content. I'm still working on 
this one.

The drawback is that you cannot simply re-use the same code parts for 
either printing OR painting into a preview window for example. I haven't 
solved this problem yet.

But maybe I misunderstood your question completely, then simply ignore 
this :-)

Rolf




More information about the User mailing list