using DFM in both Delphi and Lazarus lazarus / 10-Designer ---------------------------------------------------------------------- PeterX · 2016-09-20 12:22 Hi all, new thread about a well known building site.. Today I reopened a DFM in Delphi and Delphi complains "EReadError .. Property doesn't exist" - It's  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i LCLVersion = '1.6.0.4' ---------------------------------------------------------------------- Leledumbo · 2016-09-20 12:45 Just remove it by hand, of course Delphi has no idea at all about LCLVersion. ---------------------------------------------------------------------- PeterX · 2016-09-20 13:02 The new Lazarus-DFM is about 2 times larger than the original DFM. That would be a lot of work. I simply recovered from backup. ---------------------------------------------------------------------- JuhaManninen · 2016-09-20 13:25 Yes, using the same .dfm file between Delphi and Lazarus projects is problematic. That is why the Delphi converter in Lazarus creates a new .lfm file by default. A common .dfm file can be selected but it is useful only in some simple cases. A downside of having separate .dfm and .lfm files is obviously that all layout changes must be done in 2 places. ---------------------------------------------------------------------- PeterX · 2016-09-20 14:09 Quote from: JuhaManninen on September 20, 2016, 03:25:56 pmA common .dfm file can be selected but it is useful only in some simple cases. I can see no simple case. From the moment when Lazarus writes Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i LCLVersioninto the DFM file, Delphi 5 fails to read. ---------------------------------------------------------------------- JuhaManninen · 2016-09-20 14:37 Quote from: PeterX on September 20, 2016, 04:09:15 pmI can see no simple case. Yes, even the simple cases require some manual editing. The recommended way is to use separate .dfm and .lfm files. ---------------------------------------------------------------------- Thaddy · 2016-09-20 14:46 Quote from: JuhaManninen on September 20, 2016, 04:37:16 pmQuote from: PeterX on September 20, 2016, 04:09:15 pmI can see no simple case. Yes, even the simple cases require some manual editing. The recommended way is to use separate .dfm and .lfm files. I can say that this also goes between Delphi versions. There is no 'one' Delphi version. People leave that version they use out, most of the time. You will run into those manual edits anyway. Even just using Delphi. I second your remark. ---------------------------------------------------------------------- PeterX · 2016-09-20 15:06 Quote from: JuhaManninen on September 20, 2016, 04:37:16 pmThe recommended way is to use separate .dfm and .lfm files. Not an easy thing to maintain, I have ~ 130 forms .. ---------------------------------------------------------------------- wp · 2016-09-20 15:29 I've never tried this, but seriously, is there really a way from Lazarus back to Delphi? Even the opposite direction, from Delphi to Lazarus, is already very difficult, and I always thought this would be a one-way stree. ---------------------------------------------------------------------- PeterX · 2016-09-20 15:49 Quote from: wp on September 20, 2016, 05:29:11 pmI've never tried this, but seriously, is there really a way from Lazarus back to Delphi? Even the opposite direction, from Delphi to Lazarus, is already very difficult, and I always thought this would be a one-way stree. Well, there's no way back, but .. I currently maintain a large application running under both Delphi 5 and Lazarus 1.6 This works. ---------------------------------------------------------------------- Thaddy · 2016-09-20 16:09 Quote from: wp on September 20, 2016, 05:29:11 pmI've never tried this, but seriously, is there really a way from Lazarus back to Delphi? Even the opposite direction, from Delphi to Lazarus, is already very difficult, and I always thought this would be a one-way stree. Maybe between Lazarus and Delphi GUI, but between FPC and Delphi non- gui its a no-brainer for non-gui applications (server software). I maintain a lot of them in both worlds. ---------------------------------------------------------------------- PeterX · 2016-09-20 16:23 What's the difference ? ---------------------------------------------------------------------- wp · 2016-09-20 16:34 Quote from: PeterX on September 20, 2016, 05:49:54 pmI currently maintain a large application running under both Delphi 5 and Lazarus 1.6 This works. What's the advantage of maintaining an application for two IDEs? Or is it that the Lazarus version does not support all features of the Delphi version? Quote from: PeterXWhat's the difference?No forms, no lfm/dfm mess. ---------------------------------------------------------------------- PeterX · 2016-09-20 16:43 Quote from: wp on September 20, 2016, 06:34:33 pmWhat's the advantage of maintaining an application for two IDEs? Or is it that the Lazarus version does not support all features of the Delphi version? Well, I do this because there's a lot of differences between LCL and VCL. So lots of things do still not work under the "Lazarus version" of the program. One day I want to get rid of the ol' Delphi version, yes ! ---------------------------------------------------------------------- wp · 2016-09-20 16:59 But then, why is it necessary to recompile the Lazarus project with Delphi? ---------------------------------------------------------------------- Phil · 2016-09-20 16:59 Back in the day I used the simple DfmToLfm converter here to convert Delphi forms to Lazarus forms: http://wiki.lazarus.freepascal.org/XDev_Toolkit The idea is that I would only make form design changes on the Delphi side, then convert the forms whenever I wanted to test with Lazarus. This also provided a way to correct some LCL deficiencies on Mac, specifically to substitute a Mac font instead of the .dfm font. And also to set some controls' TabStop property to False so that tabbing skips over controls that cannot receive focus on Mac (TButton, TComboBox, TRadioGroup, etc.). Surely a simple converter from .lfm back to .dfm would be possible too. ---------------------------------------------------------------------- tk · 2016-09-20 19:03 Quote from: wp on September 20, 2016, 06:59:00 pmBut then, why is it necessary to recompile the Lazarus project with Delphi? We also maintain code to be compilable both in Delphi and Lazarus in some cases. For example, our SW has been developed in Delphi with Alphacontrols, for Win. Since there is no Alphacontrols in Lazarus, the Linux version has native look. We don't want to drop Alphacontrols for Win, so Delphi project is still necessary. And we use only one dfm for each form. There are some layout problems with this but it is better than maintaining dfm+lfm. ---------------------------------------------------------------------- PeterX · 2016-09-20 19:07 Quote from: wp on September 20, 2016, 06:59:00 pmBut then, why is it necessary to recompile the Lazarus project with Delphi? The Delphi version works. The Lazarus version is still not usable in real life. Too many regressions. With the code compiled in Delphi I can ensure that this code is still okay even though I changed a lot .. ---------------------------------------------------------------------- marcov · 2016-09-20 20:46 A simple project setting to leave the forms alone would be best. I myself use a lot of code between Lazarus and Delphi. Though the GUI ones are mostly test programs for codebases that are shared between them, I also have one zeos application. But currently there are still too many regression problems that I don't have time to actively pursue. ---------------------------------------------------------------------- CM630 · 2020-09-04 11:40 Does anyone know a convertor from LFM to DFM? I supoposed Delphi does not have an inbuilt converter. ---------------------------------------------------------------------- wp · 2020-09-04 13:49 Simply rename the .lfm file to have extension .dfm. When loading into Delphi there will be errors due to unknown properties you only can select to ignore them. ---------------------------------------------------------------------- CM630 · 2020-09-04 21:17 Thanks, renaming sound simple enough.