Recent

Author Topic: Unable to set / get margins from PageSetupDialog in Linux  (Read 1286 times)

fedkad

  • Jr. Member
  • **
  • Posts: 88
Unable to set / get margins from PageSetupDialog in Linux
« on: March 13, 2018, 07:09:04 pm »
I am on the latest trunk of Linux. But, version 1.8.2 also has the same problem. Windows is OK.

* On a new form add a TPageSetupDialog and a button.
* On the click event of the button run:
Code: Pascal  [Select]
  1. PageSetupDialog1.Execute
* The setup dialog will be displayed, but with empty Margin values.
* If you change the Margin values, nothing happens on the sample page in the dialog box.
* If you close and click again on the button to reopen the PageSetupDialog, the margin values are again empty.
* The Margins group box does not display any metric (like "inches")
* There is a useless "Printer..." button at the bottom right.
* "Source" is disabled.
* We have also a funny tab order for the controls on this dialog box.

And; yes, I do have a default printer defined on the system.
System: Ubuntu Linux 17.10 / Gtk2

jamie

  • Hero Member
  • *****
  • Posts: 971
Re: Unable to set / get margins from PageSetupDialog in Linux
« Reply #1 on: March 14, 2018, 10:42:45 pm »
maybe its a unsupported feature of the printer?

fedkad

  • Jr. Member
  • **
  • Posts: 88
Re: Unable to set / get margins from PageSetupDialog in Linux
« Reply #2 on: March 15, 2018, 10:59:26 am »
No, I have tested with physical (e.g., HP-LaserJet-Pro-P1102w) and virtual (e.g., Boomaga) printers. Always the same thing.

I guess, somebody implemented the control halfway through and did not even bother to do an initial test for it.  :D For example, the input boxes for margins accept any character (alphabetic etc.) with no input validation, even after pressing OK. This is not the case for Windows where you cannot enter invalid values for margins in the first place.

zeljko

  • Hero Member
  • *****
  • Posts: 993
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Unable to set / get margins from PageSetupDialog in Linux
« Reply #3 on: March 15, 2018, 11:45:54 am »
Please fill an issue against gtk2 printerdlg implementation in that case.

fedkad

  • Jr. Member
  • **
  • Posts: 88
Re: Unable to set / get margins from PageSetupDialog in Linux
« Reply #4 on: March 15, 2018, 11:48:06 am »
I did yesterday:
https://bugs.freepascal.org/view.php?id=33427

I tried to trace the problem. (Unfortunately, I am not very competent on this.) I have a feeling that something is missing between lines 128 and 129 in the file: components/printers/unix/cupsprndialogs.inc

Code: Pascal  [Select]
  1. function TPageSetupDialog.DoExecute: Boolean;
  2. var
  3.   Dlg: TDlgPageSetup;
  4. begin
  5.   Dlg:=TdlgPageSetup.Create(nil);
  6.   if Title<>'' then
  7.     Dlg.Caption:=Title
  8.   else
  9.     Dlg.Caption:=DefaultTitle;
  10.   try
  11.     Result:=(Dlg.ShowModal=mrOk);
  12.     if Result then begin   /// <<-- I THINK, SOMETHING IS MISSING HERE
  13.     end;
  14.   finally
  15.     Dlg.Free;
  16.   end;
  17. end;
       
« Last Edit: March 15, 2018, 12:00:22 pm by fedkad »

fedkad

  • Jr. Member
  • **
  • Posts: 88
Re: Unable to set / get margins from PageSetupDialog in Linux
« Reply #5 on: March 19, 2018, 06:54:33 pm »
Dear Forum members,

There is a ongoing development for this functionality in the latest trunk: https://bugs.freepascal.org/view.php?id=33427

I am testing the Linux (64-bit) GTK2 environment. Any other testing for other environments (especially Win32 and Win64 of Lazarus) will be highly appreciated.

You may post your findings in this forum thread or the above-mentioned Bugtracker issue.

Thanks...