Recent

Author Topic: Are there hidden properties for FORMS  (Read 1570 times)

AL

  • Full Member
  • ***
  • Posts: 189
Are there hidden properties for FORMS
« on: January 28, 2020, 03:42:48 am »
Background:
I am struggling since a few weeks to port a windows program to Darwin.
Several people on the forum tried to help me (THANK YOU ALL).

My main problem is that forms that I have built with my previous computer a Windows 7 32 bits do not show correctly when cross-compiled to Mac OS.
I now have a WIN 10 computer and Cross compile to Darwin-Cocoa and Win32.
Buttons are invisible, TACharts are upside down, etc.  A real mess.  I have checked the lfm files which look normal to me.
The win32 exec is normal and functionning.

Today I decided to rebuild one of the form which I use.
So I made a new form, placed new buttons , memo, timers, etc. on it and then copied the methods from the original form to the new form in the corresponding OnCreate, OnClick, OnClose, etc.
Guess what:  this form is perfectly showing in Windows and MacOS.
                    Everything is behaving normally.

This is same code, same project, just a different unit.
This lead me to believe that there are hidden properties / variables of the form that we do not have access, but that the compiler use.
I Have looked in the lpi, the lps and nothing in there relate to forms.
The lrj seems to contain only strings.
I have compaired also properties of a new form to the properties of my form and they all match except for size.
Is someone aware of hidden/binary code used by the compiler when compiling forms?
May be in the Unit file itself there is a hidden section?

My main form is quite complex and I would rather not rebuild it.  This would involve several hours

Any help Welcome.  Thank you

Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

Bart

  • Hero Member
  • *****
  • Posts: 3939
    • Bart en Mariska's Webstek
Re: Are there hidden properties for FORMS
« Reply #1 on: January 28, 2020, 10:22:33 am »
Which Lazarus version are you using?
The cocoa WS has been massively improved in trunk.

Bart

AL

  • Full Member
  • ***
  • Posts: 189
Re: Are there hidden properties for FORMS
« Reply #2 on: January 28, 2020, 04:09:21 pm »
Lazarus 2.1.0 r62510
FPC 3.3.1

Can this be caused by a wrong unicode?
This project evolved from an old Delphi program. So I am not sure if this form is the original Delphi form modified in Lazarus or an original lazarus form.

« Last Edit: January 28, 2020, 04:34:25 pm by AL »
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Are there hidden properties for FORMS
« Reply #3 on: January 28, 2020, 04:58:40 pm »
Try to compare the lfm from the working version and non-working version.
They should be similar (or at least you should see what's different).

Are the LCLVersion the same in the lfms.

(TACharts upside down is really weird)

Does your old project have a LRT file for the forms?

Quote
Form resource strings table LRT format support is dropped, LRJ format introduced instead
Old behavior: Form resource strings were extracted into LRT file when saving form.
New behavior: Form resource strings are extracted into LRJ file with format unified with RSJ files which are emitted by FPC 3.0.0 and up. LRT support is dropped.
Reason: LRT file format was broken by design, e.g. it didn't handle multiline captions properly (see bug 26553 for details).
Remedy: Open your project and click "Project" -> "Resave forms with enabled i18n" menu item, then rebuild your project. After this you can safely remove LRT files.
https://wiki.freepascal.org/Lazarus_1.8.0_release_notes

I don't even think the LRT and LRJ files are needed when transfering your project. They should be automatically created (same as .RES) when you compile and/or open the form and save it again.

AL

  • Full Member
  • ***
  • Posts: 189
Re: Are there hidden properties for FORMS
« Reply #4 on: January 28, 2020, 05:52:08 pm »
No LRT just LRJ
The LCL version in the lfm is shown as 2.1.0.0  but I think this is updated when you edit the form.
 
Attached are 2 screen copy .  How it look in Windows (OK)
                                           How it look in MAC (Wrong)
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Are there hidden properties for FORMS
« Reply #5 on: January 28, 2020, 06:32:46 pm »
I don't have a Mac myself but you could try the following...

Take only the incorrect .pas and .lfm FROM THE ORIGINAL PROJECT (the one which works on Windows) and try to add it to a new project on the Mac.

If it fails, take the same pas and lfm (AGAIN from the original project), remove all the code from the pas and post the incorrect lfm and (almost) empty pas here.

Perhaps someone with a Mac and knowledge about the lfm format could take a look.

(It's important to take the original incorrect .lfm (which works on Windows) because, once read on the Mac, the lfm already could be changed)

madref

  • Hero Member
  • *****
  • Posts: 823
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Are there hidden properties for FORMS
« Reply #6 on: January 28, 2020, 09:12:58 pm »
What I see from the pictures is that the Mac-version has the screen backwards.


Sometimes just rebuilding helps.

You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.6 / FPC 3.0.4
Lazarus Trunc / FPC Trunc
Mac OS X Mojave

Rainbow6

  • New Member
  • *
  • Posts: 18
Re: Are there hidden properties for FORMS
« Reply #7 on: January 28, 2020, 09:59:33 pm »
So I have Lazarus trunk on macOS Catalina (x64) running - I can try to compile the source, but I would need to have all dependencies and instructions to compile.

AL

  • Full Member
  • ***
  • Posts: 189
Re: Are there hidden properties for FORMS
« Reply #8 on: January 28, 2020, 10:14:05 pm »
Thanks for all suggestions.  But if nobody know why this happends then I will be better redoing my form.
There is for sure a remnant of the original form which screw things on Mac and works fine on windows.  I have started by putting my 2 charts on a new form and this behave normally.
I just need now to transfer the rest of the form, adjust colors and what have you so they are OK in both Windows and Mac.
Again thanks for your effort to help me.
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Are there hidden properties for FORMS
« Reply #9 on: January 28, 2020, 10:19:08 pm »
But if nobody know why this happends then I will be better redoing my form.
And if it's a bug and you don't provide a reproducable example, this bug can't be fixed (and someone else might have the same problem in the future).


AL

  • Full Member
  • ***
  • Posts: 189
Re: Are there hidden properties for FORMS
« Reply #10 on: January 28, 2020, 10:22:20 pm »
Good Point.
Once I have my program working I can make a new project with the culprit form and send it to the bug team.
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

AL

  • Full Member
  • ***
  • Posts: 189
Re: Are there hidden properties for FORMS
« Reply #11 on: January 30, 2020, 02:51:03 pm »
I found that adding a speed button to the form was causing the problem.
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

 

TinyPortal © 2005-2018