Recent

Author Topic: Inches instead of mm  (Read 2131 times)

SandyG

  • Jr. Member
  • **
  • Posts: 93
Inches instead of mm
« on: February 25, 2024, 07:49:32 pm »
More questions...

Was doing to page setup from a report and see that everything is in mm. Any options to have this in inches? Not a big deal but looks odd for folks that are still not on the metric system...


Thanks

Sandy

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: Inches instead of mm
« Reply #1 on: February 25, 2024, 08:13:20 pm »
2.54
If I smell bad code it usually is bad code and that includes my own code.

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Inches instead of mm
« Reply #2 on: February 25, 2024, 08:57:22 pm »
Have you tried setting TfrDesignerForm.Units to ruInches ?

2.54
That doesn't really help with changing the dialog from mm to inches in LazReport, does it 🤡

SandyG

  • Jr. Member
  • **
  • Posts: 93
Re: Inches instead of mm
« Reply #3 on: February 25, 2024, 10:01:42 pm »
Hmm, yes, 2.54 is not much help ;)

@rvk - Not really using the Designer in the app, so don't think that will effect it. I did try it in the tool when I created the report, but no change.

The issue is during run-time preview where you can set page size, margins, etc. The dialog only seems to show mm and can't find an option to do inches. People picking A4 in the USA might not recognize 210mm x 297mm as A4 or common 8.5"x11" paper, as well as margin settings :)

I saw the option in the run time designer to select pixels, inches, or mm for creation of the report, but not for subsequent dialogs that display options on the preview.

Not a huge deal, seems odd that no options for units in the settings for dialogs.

Sandy

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: Inches instead of mm
« Reply #4 on: February 26, 2024, 12:08:29 pm »
2.54 is helpful if you know your math. you do not need a calculator for that, it least i don't. :o
If I smell bad code it usually is bad code and that includes my own code.

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Inches instead of mm
« Reply #5 on: February 26, 2024, 12:14:05 pm »
2.54 is helpful if you know your math. you do not need a calculator for that, it least i don't. :o
It also wasn't the question.
But I didn't expect any less of you 🤡

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Inches instead of mm
« Reply #6 on: February 26, 2024, 12:46:18 pm »
2.54 cm to 1 inch true, OP is talking in mm so 25.4mm to 1inch. to be imperialistic

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Inches instead of mm
« Reply #7 on: February 26, 2024, 12:53:19 pm »
Was doing to page setup from a report and see that everything is in mm. Any options to have this in inches?
Question is clear. It's not about calculation but about the option to show everything in inches.

It's not possible. The page option uses a string resource in "mm" and a function to do mm to pixels. This could be changed but there is currently no option to do it simply via setting a property to inches.

(Changes would involve changing the resourcestring and overriding the call to do inches to pixels.)


cdbc

  • Hero Member
  • *****
  • Posts: 1665
    • http://www.cdbc.dk
Re: Inches instead of mm
« Reply #8 on: February 26, 2024, 01:04:23 pm »
Hi
Just a wild shot in the dark... Couldn't one perhaps define a 'Helper' for this?!?
My 2 cents
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: Inches instead of mm
« Reply #9 on: February 26, 2024, 01:32:01 pm »
Just a wild shot in the dark... Couldn't one perhaps define a 'Helper' for this?!?
It would be a great option. Problem is that LazReport isn't programmed very modular.

The lrpgopt.pas, where the page options are, has labels and edits which are accessed directly (yikes), and it is called by lt_view (TfrPreviewForm).
The TfrPreviewForm.PageSetupBtnClick, where the "Margins.Left := MMStrToPoints(E3.Text);" is done, isn't overridable.

So it would involve at least changing the source of LazReport itself (or inheriting TfrPreviewForm and reprogramming the whole thing). You could use the bare boned preview without buttons and program your own page dialogs with inches. But OP already stated it isn't that big of a problem so probably this would be overkill (in this case). It is something others, who really do need inches, to take into account when using LazReport.

It was strange to see the Units ruInches. But it only seems to be in the designer and doesn't get used very much (at least not in the dialogs).

SandyG

  • Jr. Member
  • **
  • Posts: 93
Re: Inches instead of mm
« Reply #10 on: February 26, 2024, 09:22:20 pm »
Looks like a can of worms to fix, and likely best idea for me would be to disable the option to display. Seems pretty short sighted of the developer not to allow the other unit type or be able to extend easily. Oh well, glad it at least works as well as it does can't really complain too much knowing the little I know  :)

Thanks for the comments!

Sandy

 

TinyPortal © 2005-2018