Forum > General

Cross Platform Form/GUI Maintenance

(1/2) > >>

sfeinst:
I have begun writing an app using Lazarus.  I've noticed that as I move between environments (in my case Windows and Linux), forms do not look so good.  If I create on Windows, the fonts are too large on Linux.  If I create on Linux, fonts are too small on Windows.  In both cases, some items do not line up when I switch.

I was wondering how other developers handle this.  What I began to do is put in a $IFDEF WINDOWS and a $IFDEF LINUX and then I set the fonts at startup.  But that does not always fix the problem (making a button large enough for Windows font may be too small or too large for the Linux font).  But it worked on the app so far.

Do you set the fonts and sizes in code?
Do you code fully in one environment and only build in the other so you realign and modify fonts prior to compiling?
Do you keep two copies of the lfm file?
Something else?

Thanks

Leledumbo:
Read LCL AutoSizing, this will solve the size, position, and alignment problem. Don't know about fonts since I never set other than the default value.

sfeinst:

--- Quote from: Leledumbo on February 26, 2010, 10:22:25 am ---Read LCL AutoSizing, this will solve the size, position, and alignment problem. Don't know about fonts since I never set other than the default value.

--- End quote ---

Thanks for the link.  It gives some useful info.  I think some of my alignment issues are font related.  As an example, I have a TLabeledEdit within a Group Box.  On Windows, it all fits, in Linux (because it tends to use a larger font - especially since it has to guess which Linux font to use to replace the Windows one), the label gets pushed outside of the group box.

I have changed the fonts on most items, I may try and reset them to the default to see what happens.

Zoran:
This says something about fonts: http://wiki.lazarus.freepascal.org/Lazarus_For_Delphi_Users#TControl.Font.2FTControl.ParentFont

Anyway, my advice to you is just to always set AutoSize to true and use anchoring, I find it very helpful.

Also read this two articles:
http://wiki.lazarus.freepascal.org/Autosize_/_Layout
http://wiki.lazarus.freepascal.org/Anchor_Sides

Leledumbo:

--- Quote ---the label gets pushed outside of the group box
--- End quote ---
As Zoran points, this issue is related to autosizing and anchor sides. Set autosize to true so that the size is big enough for the font to appear as a whole, and set the (relevant) label anchors to the owner control (in your case, the group box).

Navigation

[0] Message Index

[#] Next page

Go to full version