[Gambas-user] Printing from a module

Tobias Boege taboege at ...626...
Thu Nov 15 14:38:31 CET 2012


On Thu, 15 Nov 2012, Rolf-Werner Eilert wrote:
> Hi folks, I have a question:
> 
> In FMain I have a Printer object (Printer icon) and a Button to click on 
> for printing.
> 
> The whole printing procedure should take place in a separate module to 
> keep the lengthy code apart from FMain code.
> 
> The Button_Click event calls druck.start in the module "druck". But my 
> printing object "drucker" isn't known there.
> 
> So, what must I write to switch from FMain to the printing module? How 
> can the module know about my printer object?
> 
> I have made public the forms, I have made public the Printer object. But 
> still its name ("drucker") is unknown in the module.

If you successfully made your control public, I don't know what could be
wrong but you can still do druck.start(drucker), i.e. give the object as
a parameter to the module. This would make the code even more generic ;-)

(It _may_ be possible that you just have to use FMain.drucker but I don't
remember.)

Regards,
Tobi




More information about the User mailing list