[Gambas-user] printer problem

Doriano Blengino doriano.blengino at ...1909...
Fri Feb 5 17:45:23 CET 2010


Charlie Reinl ha scritto:
> Am Freitag, den 05.02.2010, 17:06 +0100 schrieb Doriano Blengino:
>   
>> Charlie Reinl ha scritto:
>>     
>>>>> So I repeat my question, where/how can I see/test the output device,
>>>>> after printer.setup.
>>>>>   
>>>>>       
>>>>>           
>>>> Printer.name.
>>>> This name identifies a CUPS device, and has little to do with the 
>>>> physical device.
>>>>
>>>>
>>>>     
>>>>         
>>> Salut,
>>>
>>> about Printer.Setup()
>>>
>>> It is easily possible to leave Printer.Setup() with the Printer.Name and
>>> the Printer.file filled (see attached Printer Properties.png)
>>>
>>> This happened, while jumping between, "Print to printer" and "Print to
>>> file" or simply when your Printer object is called several times with
>>> different targets.
>>>
>>> The Printer object knows, what to do, so there is not the problem.
>>> But if the gambas-coder, after leaving the Printer.Setup(), wants to
>>> know if "Print to printer" or "Print to file" was chosen, he has as
>>> possibility only to ask if Printer.Name or Printer.file are filled.
>>>
>>> And that can be (as in Printer Properties.png shown) both one.   
>>>
>>> So what is needed, is a "target property" which says something like 
>>> target = printer or target = file  
>>>
>>> Gambas2=2.19.0                  Revision: 2654
>>> qt
>>>   
>>>       
>> It seems to me, but I could be wrong, that if printer.file is filled, 
>> then the job goes to a file. If it is empty, then the job goes to a 
>> "real" printer. About the setup() dialog, may be it is bugged - I mean, 
>> perhaps it is possible to close the dialog and have both printer.file 
>> and printer.name set.
>>
>> === correction ===
>> it is bugged.
>> I made a simple project where setup() is called and just after return 
>> the values of .file and .name are printed. It is so easy to get them 
>> both set...
>>
>> -- BUT THERE IS A WORKAROUND --
>>
>> Just set printer.file="" before invoking setup(). Apparently they did 
>> more work than what is documented. This solves. The printer.file get set 
>> only if you press OK having "Print to file" checked.
>>
>>     
>
> That works for a clean entry. But do it also for Printer.Name
>
>   
No, the result after

    printer.file = ""
    printer.setup

is predictable:

    if printer.file<>"" then
      ' output goes to a file
      printer.copies=1
    else
      ' output goes to a real printer
      application.messagebox("Take the toasting bread out of the printer 
named " & printer.name)
      application.messagebox("Now put some blank paper into the printer")
    endif

...or am I missing something?

Regards,
Doriano




More information about the User mailing list