Recent

Author Topic: [Abandoned] Font dialog different in Windows and Linux versions?  (Read 2268 times)

Hopestation

  • Full Member
  • ***
  • Posts: 181
Hi.
I am running Lazarus Version 2.08 and FPC 3.04 on a windows10 Laptop and a Mint Tower with a large monitor.

I do my development in Linux because of the bigger screen, but run the programs on the Windows  laptop.

I have an Edit box on my form with a Font Dialog box to set the text size at run time.

In Linux the only dialog options are font, style and size.

In the Windows version I get more options including colour.

I added a colour dialog to the form and used this to change the text colour but when I use the Font dialog to change the text size the colour defaults to black.

The only way to overcome this seems to be: don't develop programs in Linux.

If Lazarus is Write Once Compile Anywhere how is this possible?
« Last Edit: April 29, 2021, 12:57:44 pm by Hopestation »

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Font dialog different in Windows and Linux versions?
« Reply #1 on: April 27, 2021, 03:38:47 pm »
Perhaps one of the devs can answer better, but here is my understanding. Lazarus uses the native widgets, however the possible settings must be the same on all platforms. For example, on Mac the color dialog allows selecting transparency, but it has no effect since transparency is not an option on Windows.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Font dialog different in Windows and Linux versions?
« Reply #2 on: April 27, 2021, 04:54:34 pm »
Hi!

Yes it depends on the widget set.

Example: In Windows 3.x days the font dialog included also the font color which could be set.

In later Windows versions this was abolished, because you cant set the font color for the elements of the widget set anymore.

They call it progress.

Winni

Hopestation

  • Full Member
  • ***
  • Posts: 181
Re: Font dialog different in Windows and Linux versions?
« Reply #3 on: April 27, 2021, 05:11:11 pm »
Thanks for the answers.

I don't understand the logic.

If a team is writing code to be usable on any OS don't they make the components identical?

When I look at the Object Inspector Font options for a Text Box in Linux it has the same items as the Windows version.

Shouldn't the dialog box give the option to change every property that is available?

Surely over-riding the colour of the text to a different value from its current setting is wrong.

wp

  • Hero Member
  • *****
  • Posts: 13264
Re: Font dialog different in Windows and Linux versions?
« Reply #4 on: April 27, 2021, 07:46:08 pm »
If Lazarus is Write Once Compile Anywhere how is this possible?
The slogan is not: "Write once,  your programs behaves the same everywhere".

The basic idea is to write the same code which can compile and run on all supported operating systems using the native controls - with the emphasis on "NATIVE CONTROL". But due to the differences between the operating systems these controls may behave differently, in particular when colors are involved. I agree that this is a problem for a new user who sees the property Color in the object inspector and is disappointed when he cannot adjust it to its needs. There are also subtle changes in the order of events which may lead to different logical behaviour. You must always double-check on the other platform whether the program behaves properly. Usually there is always a workaround in case of issues.

In order to write cross-platform applications you should not change colors, fonts, or at least in a way which works on all platforms that you want to support. A typical problem is the form layout. Do not place controls on the form using the mouse, but use the anchor editor to align the controls to each other. This is because font matrics are always a little bit different, and thus text may overlap into controls. I know this is against the "RAD" slogan ("Rapid application development"). But life is different than advertisments...

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Font dialog different in Windows and Linux versions?
« Reply #5 on: April 27, 2021, 09:17:09 pm »
If a team is writing code to be usable on any OS don't they make the components identical?

The goal is to use native widgets, not Lazarus widgets. Unfortunately, as you note, native widgets can vary in their support of some things like font color.

A quick test suggests that setting the font color using FontDialog:

- Works on Windows
- Is not supported on Linux because Linux does not provide a font color option.
- Should work on Mac, because Mac does provide a font color option, but does not (a bug presumably).

Apparently on Linux the font returned by FontDialog is always black, but that is not a Lazarus bug.
« Last Edit: April 27, 2021, 09:32:42 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Font dialog different in Windows and Linux versions?
« Reply #6 on: April 27, 2021, 09:31:38 pm »
A second quick test (attached) to set a font color using the ColorDialog works for me on Windows, Mac, and Linux.

If you don't want Linux to set the font color black in FontDialog, try saving it before executing the FontDialog, and restoring it after.
« Last Edit: April 27, 2021, 09:35:09 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

Fred vS

  • Hero Member
  • *****
  • Posts: 3720
    • StrumPract is the musicians best friend
Re: Font dialog different in Windows and Linux versions?
« Reply #7 on: April 28, 2021, 02:25:41 am »
Hi.
I am running Lazarus Version 2.08 and FPC 3.04 on a windows10 Laptop and a Mint Tower with a large monitor.

I do my development in Linux because of the bigger screen, but run the programs on the Windows  laptop.

I have an Edit box on my form with a Font Dialog box to set the text size at run time.

In Linux the only dialog options are font, style and size.

In the Windows version I get more options including colour.

I added a colour dialog to the form and used this to change the text colour but when I use the Font dialog to change the text size the colour defaults to black.

The only way to overcome this seems to be: don't develop programs in Linux.

If Lazarus is Write Once Compile Anywhere how is this possible?

Hello.

If you want the exactly same aspect of all the widgets for Windows, Linux and FreeBSD you should use MSEgui or fpGUI widgetset.

Fre;D
« Last Edit: April 28, 2021, 02:29:30 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Font dialog different in Windows and Linux versions?
« Reply #8 on: April 28, 2021, 05:05:50 am »
I'm with wp, for cross-platform it is essential to use the anchor editor for native controls. Other options are available if you want to use non-native controls.

A major reason I use Lazarus is the support for native controls.
« Last Edit: April 28, 2021, 05:12:23 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1331
  • Professional amateur ;-P
Re: Font dialog different in Windows and Linux versions?
« Reply #9 on: April 28, 2021, 06:25:53 am »
Hey WP, VTwin,

I'm with wp, for cross-platform it is essential to use the anchor editor for native controls. Other options are available if you want to use non-native controls.

HOLY MOTHER OF CTHULU!!!!

I just clicked on the ellipse(...) button on the Anchor property and I was transported to a whole parallel galaxy in terms of making the UI be all compliant in many WidgetSets.

Thank you SO very much for this little tidbit.

I guess I'll have to invest a few hours in mastering that whole dialog, cuz there's a SH*T TON of stuff to absorb!!

And AGAIN, thank you both for mentioning it(WP) and insisting that it should be used often(VTwin)!!!

Cheers,
Gus

PascalDragon

  • Hero Member
  • *****
  • Posts: 6229
  • Compiler Developer
Re: Font dialog different in Windows and Linux versions?
« Reply #10 on: April 28, 2021, 08:59:33 am »
I guess I'll have to invest a few hours in mastering that whole dialog, cuz there's a SH*T TON of stuff to absorb!!

You might also want to take a look at this wiki page. ;)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1331
  • Professional amateur ;-P
Re: Font dialog different in Windows and Linux versions?
« Reply #11 on: April 28, 2021, 10:11:42 am »
Hey PascalDragon,

You might also want to take a look at this wiki page. ;)

MAAAN you do know how to pile on the good stuff!!

Thank you SOOOOO much for the link to the wiki.
It's well presented and it avoids SO much trial and error.
I could hug you if it wasn't for this bloody social distancing... well and the fact that I don't know where you are :P (or the fact that it would be creepy ;) )

I'm really ecstatic for the possibilities that y'all just opened to me.
I've been struggling with the inherent issues of mouse positioned components and the problems that arise when you cross-platform.
With this new avenue of information I can try and solve some of them.
It finally present to me a bit of the flexibility of HTML+CSS that we've discussed in another thread(remember that one? I'm still ashamed of my conduct...) and it reminds me of doing QT dev where you have to add panels(They're called something else) everywhere because every component is anchored to, and, relative to the parent.

My peeps(PascalDragon, WP and VTwin) I can't thank you enough for opening my eyes to the new possibilities on proper UI Design :)

Cheers,
Gus
« Last Edit: April 28, 2021, 10:13:44 am by Gustavo 'Gus' Carreno »

Hopestation

  • Full Member
  • ***
  • Posts: 181
Re: Font dialog different in Windows and Linux versions?
« Reply #12 on: April 29, 2021, 12:57:02 pm »
Thanks to every who replied.
I thought that this was asimple question but it has gone way beyond my programing knowledge: what's a widget?
At the age of 76 it's too lat to start getting involved in all that so I will ignore the fonta color in Linux because the program will be run in Windows, where the problem doesn't exist.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6229
  • Compiler Developer
Re: Font dialog different in Windows and Linux versions?
« Reply #13 on: April 29, 2021, 01:19:24 pm »
I thought that this was asimple question but it has gone way beyond my programing knowledge: what's a widget?

Essentially every visible component is a widget: a button, an edit, a panel, etc.

 

TinyPortal © 2005-2018