Recent

Author Topic: SOLVED-Help Identifying the Source of a bug in Lazarus -- Related to CustomForms  (Read 3473 times)

mtrsoft

  • New Member
  • *
  • Posts: 44
Hi,
I would like to port a few programs from Delphi XE2 to Lazarus but can't do this because of a bug in Lazarus.

I reported the bug about two years ago and it was confirmed, but no one has taken up the challenge of fixing it.

Details can be found in the Lazarus BugTracker by searching for "0030241", which is the ID of the report and has a summary starting with "CustomForm".

Basically, the issue is that CustomForms can be used to create a TForm descendant that has new published properties and events, which initially appear in Lazarus' Object Inspector, but after the application is closed and then re-opened the new properties and events can not be found or displayed in the Object Inspector.

The design of my DXE2 app makes extensive use of form inheritance of forms with new published properties and events, hence my problem. Also, I would like to develop new apps in Lazarus that use the same design.

My questions are:

1.   Is there someone out there who is capable of and willing to fix the bug?

2.   Can anyone tell me how to start to trace the origin of the bug?
      (a)   What is the name of the (highest level) Lazarus source file that loads forms into the IDE?
      (b) Is it possible to load Lazarus into Lazarus as an app and trace through it?

Any and all suggestions and assistance would be greatly appreciated.

Regards,
John
« Last Edit: September 04, 2018, 02:08:29 am by mtrsoft »

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
I can reproduce the issue on Lazarus 1.8.4 Linux Gtk2. And this is the bug report of the issue:
https://bugs.freepascal.org/view.php?id=30241

taazz

  • Hero Member
  • *****
  • Posts: 5368
Hi,
I would like to port a few programs from Delphi XE2 to Lazarus but can't do this because of a bug in Lazarus.

I reported the bug about two years ago and it was confirmed, but no one has taken up the challenge of fixing it.

Details can be found in the Lazarus BugTracker by searching for "0030241", which is the ID of the report and has a summary starting with "CustomForm".
A direct link would be easier to follow but the tracker number should suffice for now.

Basically, the issue is that CustomForms can be used to create a TForm descendant that has new published properties and events, which initially appear in Lazarus' Object Inspector, but after the application is closed and then re-opened the new properties and events can not be found or displayed in the Object Inspector.
Well, You leave a lot to the imagination with that description do you have some sort of add in installed in lazarus for each extra form? You use some other kind of mechanism? In general if its an addin then it should work properly the RTTI info are there.
The design of my DXE2 app makes extensive use of form inheritance of forms with new published properties and events, hence my problem. Also, I would like to develop new apps in Lazarus that use the same design.

My questions are:

1.   Is there someone out there who is capable of and willing to fix the bug?
wrong place to ask better try the mailing list. Or you could post a boundy and see if any one is willing to solve for the amount of money you are willing to spend.
2.   Can anyone tell me how to start to trace the origin of the bug?
      (a)   What is the name of the (highest level) Lazarus source file that loads forms into the IDE?
      (b) Is it possible to load Lazarus into Lazarus as an app and trace through it?

The Source of the IDE come preinstalled with lazarus at <lazarus install directory>\IDE\lazarus.lpk opening it in lazarus it self and running through the debugger is one way to track it down.

If everything else fails please keep in mind that a short sample that demonstrates the problem is always going to help get a faster response. If its an addin you talking about the a sample addin that one can install in the IDE with a small text of what is expected and what it is shown and if applicable under what conditions  is the bug surfacing.

In any case I'll take a look on the bug report mostly out of curiosity.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
A direct link would be easier to follow but the tracker number should suffice for now.

taazz, it is very easy to find by the tracker number. The bugtracker has an edit field and a jump button for that.

Quote
Well, You leave a lot to the imagination with that description ...
No, nothing is left to imagination because there are clear steps to reproduce. This is one of the well made bug reports.

Quote
Or you could post a boundy and see if any one is willing to solve for the amount of money you are willing to spend.
+1

Quote
The Source of the IDE come preinstalled with lazarus at <lazarus install directory>\IDE\lazarus.lpk opening it in lazarus it self and running through the debugger is one way to track it down.
Actually it is lazarus.lpi (not .lpk).
This project cannot be used to build Lazarus but it is used for debugging. First build Lazarus with debug info by other means. Then open project lazarus.lpi and press F9. Keep track of which window belongs to which instance.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

balazsszekely

  • Guest
I did take a quick look. Please try the following:
1. Open package lazcustforms.lpk
2. Open unit customforms
3. Add FormEditingIntf to the uses clauses
4. Go to method register and add the following line:
Code: Pascal  [Select][+][-]
  1. Procedure Register;
  2. begin
  3.   //...
  4.   For I:=0 to CustomFormList.Count-1 do
  5.     begin
  6.     D:=TCustomFormDescr(CustomFormList[i]);
  7.     RegisterProjectFileDescriptor(TCustomFormFileDescriptor.Create(D),D.Category);
  8.     FormEditingHook.RegisterDesignerBaseClass(D.FFormClass); //<----This one
  9.     end;
  10. end;

5. Rebuild the IDE
6. Create a new project with Appforms then save it, close IDE then reopen

mtrsoft

  • New Member
  • *
  • Posts: 44
Getmem,

THANK YOU!
You have solved the issue.

Thank you again.
Regards,
John

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
I did take a quick look. Please try the following:


Very awesome for a quick look.  Much appreciated.
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Wow, it was much simpler than I thought.
I applied the solution in r58838 (trunk). Please test.

I also cleaned uses sections in the demo package units and added a Register procedure there. Without it the IDE complained about fat Lazarus. It was not even obvious that the package had to be installed into IDE.
The custom forms are still registered during initialization and the Register procedure is empty. For some reason it does not work otherwise.

I guess Balázs will need more commit rights for future fixes and improvements.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

mtrsoft

  • New Member
  • *
  • Posts: 44
Juha,

This is to confirm that the changes you made in r58838 work properly on a Win7 /32 system with Lazarus 1.8.4.

Thank you.
Regards,
John

P.S. How can I insert a "SOLVED" at the beginning of the Subject line?
JR
« Last Edit: September 03, 2018, 10:19:20 pm by mtrsoft »

taazz

  • Hero Member
  • *****
  • Posts: 5368
P.S. How can I insert a "SOLVED" at the beginning of the Subject line?
JR
You edit the first post and type on the title. There is no other way.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018