[Gambas-user] Print Dialog following the Printer.Configure - Method

Claus Dietrich claus.dietrich at freenet.de
Fri Dec 22 14:49:20 CET 2023


Hi Lee

Am 21.12.23 um 19:28 schrieb T Lee Davidson:
> This printer configure dialog issue looks like quite a mess. This:
> [code]
>   Debug "Device Resolution:" & Paint.Device.Resolution
>   Debug "Paint width: " & Paint.Width
>   Debug Subst("Resolution: X=&1, Y=&2", Paint.ResolutionX, 
> Paint.ResolutionY)
>   Debug "PaperWidth: " & prtText.PaperWidth
>   Debug "print margin: " & PRINT_MARGIN
>   With hExtents
>     Debug Subst("hExtents: W=&1, H=&2, X=&3, X2=&4, Y=&5, Y2=&6", .W, 
> .H, .X, .X2, .Y, .Y2)
>   End With
> [/code]
>
> inserted into the Printer_Begin() event handler, of the Gambas source 
> code Printer example, yields the following no matter what print device 
> is selected (printer or file) in the printer configure dialog:
>
> With GTK3:
> FMain.prtText_Begin.104: Device Resolution: 300
> FMain.prtText_Begin.105: Paint width: 595.275590551181
> FMain.prtText_Begin.106: Resolution: X=72, Y=72
> FMain.prtText_Begin.107: PaperWidth: 210
> FMain.prtText_Begin.108: print margin: 28.3464566929134
> FMain.prtText_Begin.110: hExtents: W=152, H=398, X=0, X2=152, Y=-6, 
> Y2=392
>
> (The Paint resolution isn't even close to the Device resolution.)
>
> With Qt5:
> FMain.prtText_Begin.104: Device Resolution: 1200
> FMain.prtText_Begin.105: Paint width: 9917
> FMain.prtText_Begin.106: Resolution: X=1200, Y=1200
> FMain.prtText_Begin.107: PaperWidth: 210
> FMain.prtText_Begin.108: print margin: 472.238095238095
> FMain.prtText_Begin.110: hExtents: W=4218, H=8704, X=0, X2=4218, 
> Y=-90, Y2=8614
>
> I agree that the GTK dialog, being non-/dis-funcitonal, is virtually 
> useless. I find no way whatsoever to change the margins in that 
> dialog. And, it provides a third, "Preview", button for which 
> Printer.Configure() cannot provide since it returns a boolean.
>
> In that example, the print margin is calculated based on the ratio of 
> Printer.PaperWidth to Paint.Width. It seems that calculation cannot 
> use any margin properties as I find no Margin (or even PrintWidth or 
> similar) property in Printer. Having something like that might make 
> Printer.Configure() more useful. But, I don't know if that is even 
> possible especially given that the GTK dialog wouldn't provide any 
> margin settings at all AFAICT.
>
> Maybe someday someone will create a GUI toolkit that does everything 
> right. 😕
>
>
> -- 
> Lee

Thanks for all these details! This fully confirms my observations. When 
you add the gb.form.print component you will find four additional 
properties in the Printer class ... MarginLeft, MarginRight, MarginTop, 
MarginBottom, but I also didn't find any use for them in conjunction 
with the print dialog invoked by the Configure method. They also seem to 
have no communication with the dialog. I hope for someone, who can bring 
some light into this. Is there a way to get around an own print dialog 
for the printer class?

Best regards

Claus






More information about the User mailing list