Recent

Author Topic: Units/Forms added to project doesn't show in inheritance project component list  (Read 1332 times)

bpranoto

  • Jr. Member
  • **
  • Posts: 84
When I add existing units/forms (originally created in other project) to a new project, those forms are not shown in the list of units/forms which can be inherited.

Here is the step to reproduce the problem:
1. Create a project1 with 2 forms (blank forms are enough):
    unit project1_unit1, form name: TFormProject1Form1
    unit project1_unit2, form name: TFormProject1Form2

2. Create a project2 with just 1 blank form.
    Add files from project1 above:
    project1_unit1.pas
    project1_unit1.lfm
    project1_unit2.pas
    project1_unit2.lfm

3. Try to inherite a new form:
    File -> New... ->Inherited project component
    You'll see the forms which just added are not shown in the list.

Environment:
Lazarus 2.0.12
O/S: Linux ubuntu 18.04 64bits

Do I miss something or is it a bug?

Attached are zip for those 2 projects, if you want to try, just extract the zip and do the step 3

GetMem

  • Hero Member
  • *****
  • Posts: 3986
@bpranoto

Quote
Do I miss something or is it a bug?
It looks like a bug to me, I can reproduce the issue with Lazarus Trunk/FPC 3.2.0.  Until the bug is fixed, here is a quick workaround:
1. Add the units to project2
2. Close Lazarus
3. Open project2.lpi with a text editor
4. Modify the nodes according to the attached image, save changes
5. Open Lazarus again then try New-> Inherited project component

bpranoto

  • Jr. Member
  • **
  • Posts: 84
It looks like a bug to me, I can reproduce the issue with Lazarus Trunk/FPC 3.2.0.  Until the bug is fixed, here is a quick workaround:

Ok, thanks for confirming. I will make a bug report.

Usually, my work around is edit the new unit manually

1. Create a new form
2. Add the unit I want to include in interface uses clause
3. Edit the statement:
Code: Pascal  [Select][+][-]
  1. type
  2.   TForm2 = class(TForm)
  3.  

into
Code: Pascal  [Select][+][-]
  1. type
  2.   TForm2 = class(TFormProject1Form2)            
  3.  
4. Save and close the new unit.
5. Reopen the new unit

Eventually, after add an unit manully and several compilation the unit appears on the inheritanceable unit.

bpranoto

  • Jr. Member
  • **
  • Posts: 84
@getmem,

Bug is reported: https://bugs.freepascal.org/view.php?id=38584

Thanks for the workaround, now I know what the problem is...

GetMem

  • Hero Member
  • *****
  • Posts: 3986
@bpranoto

I fixed the issue in r.64748. Please test.

bpranoto

  • Jr. Member
  • **
  • Posts: 84
@bpranoto

I fixed the issue in r.64748. Please test.

Just test it. It works very well, thank you very much.

 

TinyPortal © 2005-2018