[Gambas-user] Printing from a module

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Nov 15 15:53:08 CET 2012


Am 15.11.2012 15:30, schrieb Fabien Bodard:
> Why the printer is on your form ?

Because I saw this in the printer example :-) And it kinda works.

>
>
> In your module declare a new printer
>
> Drucker = new printer() as "Drucker"

It complaints about the (), i. e. it says ") too early". So I left the 
brackets away. Then it is accepted, but:

>
> You must declare the printer where you use it.
>
> There is another way but i think this one is the most simpler. Andif i
> understand well you don't need the printer object on the form

That's true, but the button is on the form, and so the form calls the 
procedure in the printing module. When I try what you say, this is what 
comes out:

in FMain Sub Button7_Click:

   druck.start

Too few arguments

   druck.start(drucker)

Unkown expression drucker

I tried all variations... no way to get it working.


>
>
>
> 2012/11/15 Tobias Boege <taboege at ...626...>
>
>> 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
>>
>>
>> ------------------------------------------------------------------------------
>> Monitor your physical, virtual and cloud infrastructure from a single
>> web console. Get in-depth insight into apps, servers, databases, vmware,
>> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
>> Pricing starts from $795 for 25 servers or applications!
>> http://p.sf.net/sfu/zoho_dev2dev_nov
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
>





More information about the User mailing list