Forum > Designer

Lazarus write once compile anywhere - what to expect when designing applications

(1/2) > >>

Hansaplast:

With this topic, I'm not trying to start a flame war or endless discussion.
I'm just trying to find out what the Lazarus philosophy will be moving forward.


I've used and enjoyed Lazarus Pascal for several years now, and have developed several small applications for Windows, Linux and MacOS (Carbon). One thing I absolutely loved about Lazarus is that I code and design my application on one platform (write once) and simply move a project to another platform (compile anywhere) and hit compile to get the same application up and running just the way I designed it. Which matches the "identical products" in the Wiki statement "... you don't need to do any recoding to produce identical products for different platforms." (source)


With the recent changes on the macOS platform (Cocoa), I've been trying to force myself to work with Cocoa as much as I can, trying to create a 64 bit Cocoa application and report bugs in case I run into them. Since Cocoa in in alpha stage, issues will still be found of course.


One thing, in my opinion, that appears to be problem is that the "compile anywhere" does work, but the UI design is definitely not consistent anymore accross platforms.


I used to be able to design in Carbon, and it would look exactly the same in Windows and Linux.
With Cocoa this is (in it's current stage) no longer the case.


Instead the design is trying to match what XCode would do (macOS) which means that the IDE must be compiled in Cocoa as well, otherwise the design will simply not match up with the end product. Positions of TButton, size of TPanels, etc. most of it simply does not match. Some of these issues can be addressed by anchoring, but after 3 months of toying with this I can hoenstly say that this simply doesn't work to resolve these issues.


So what is the Lazarus philosophy moving forward?


- Write once (code and UI) and Compile Anywhere (reproduce identical products for different platforms)?
Or
- Try to match whatever UI design guidelines are set per platform?


I'd prefer to be able to build an application on one platform, and recompile it, looking identical, on another platform.
Or maybe an option should be defined allowing both (probably more complicated): "LCL Style" vs "Native Style"?

Thaddy:
This is a false statement and has never been the case:
--- Quote ---Write once (code and UI) and Compile Anywhere (reproduce identical products for different platforms)?
--- End quote ---
What the "write once, compile anywhere" pretends and strives for is identical functionality, not look-alikes. The look and feel should always be based on the chosen widgetset, which differs from a platform.
Any problems are usually caused by stubborn programmers that use features that are specific to a certain widgetset and get caught out by doing so when they port to a different platform.
That's mostly thoughtless or even brainless. Lazarus still requires that you design your applications with the largest common subset in mind. If you don't you will get bitten.

Hansaplast:
Thanks Thaddy.


I can see what you're saying, and I most certainly did not want to start a discussion, criticize or offend anyone - apologies if that is the case. I very much enjoy and respect all the hard work done by others, so I have a tool to develop with. I was just looking for a clear statement where we are and/or where we are going with Lazarus, so I can anticipate what to do when developing an application.


I guess there are 2 things to look at.


First the interpretation of the Wiki page stating:
"Lazarus and Free Pascal strives for write once compile anywhere. Since the exact same compiler is available on all of the above platforms it means you don't need to do any recoding to produce identical products for different platforms.".

Based on your input, this should probably be rewritten as it could be interpreted differently than intended. "Identical products" sounds a lot like that the appearance of the applications will very similar (assuming the use of standard components, and not platform specific features) - which has been the case in my experience (intentional or not) when developing for macOS(Carbon)/Windows/Linux.


Second thing is indeed platform specific limitations and/or features. I always stay away from platform specifics, if Lazarus doesn't support a function or feature on all platforms, then I will simply not use it. So you will not see me use MacOS or Window specific features or functions.
I agree with designing applications with the largest common divider in mind - don't use something specific for macOS and expect Windows to handle this correctly (or at all).


However, as an example, two standard TPanels or TPageControls placed next to each other, may look different (rounded corners versus square corners, or different looking caption) - which is not a big deal. This worked as described under Windows/Linux/Carbon. However when width, position and spacing between these 2 components appear very different (in Cocoa), then I'd say this could be a problem. I tried to solve this by anchoring things, but it does not solve this issue. Any recommendations are most welcome.


Another examples are buttons. I totally understand that Cocoa (for example) has limitations (natively) what a button can look like (height, etc). Again not a problem, but when positions are just different, then again this could be an issue as well.


So should the position and width of these two examples appear the same on all platforms? Neither are platform specific features (left, top, width). Or is it to be expected that they are different?

wp:
I have ignoried the AnchorEditor for a long time - now I'd say: it would have saved me from a lot of trouble. If you intend to write a cross-platform application use it whenever you can. The different font sizes, control sizes on different platforms, different text lengths in translated versions, are not a problem any more.

The only disadvantage is that is quite difficult to modify an existing layout, e.g. insert another control into a chain of controls anchored to each other, or to move controls to other containers.

Handoko:
For most cases, we should use the OS native (style) controls. But if uniformity appearance is important, we can use OS-independent components:

http://wiki.freepascal.org/Lazarus_Custom_Drawn_Package
http://wiki.lazarus.freepascal.org/BGRAControls
http://wiki.freepascal.org/Eye-Candy_Controls
http://wiki.freepascal.org/User:Alextp#Components

Navigation

[0] Message Index

[#] Next page

Go to full version