[Gambas-user] Printing from a module

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Nov 15 13:17:59 CET 2012


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.


In FMain:

Public Sub Button7_Click()

   druck.start

End

In module "druck":

Sub start()

drucker.OutputFile = "~/test.pdf" 'THIS IS WHERE THE ERROR OCCURS

   If drucker.Print() Then
     Message.Info("Hä?")
   Endif


End

Public Sub drucker_Draw()

   Paint.Text("Hallo", 200, 200)

End


Thanks a lot for your help!

Rolf





More information about the User mailing list