Lazarus

Using the Lazarus IDE => General => Topic started by: valter.home on April 17, 2021, 05:27:57 pm

Title: [SOLVED] Help: The Form has disappeared from View Project Forms
Post by: valter.home on April 17, 2021, 05:27:57 pm
Hello everybody. Unfortunately I made a mess while saving a new unit. I cannot list the exact steps but I realized that I was saving the Form unit with another name, I canceled it but now I no longer have access to the Form during the design phase. The application is compiled and starts normally but no more warnings appear in the Messages window.
Where could I look to restore it?
It's a disaster, there are thousands of lines of code and a form with a very complex TPageControl. Rebuilding everything would be a tough job.
Title: Re: Help: The Form has disappeared from View Project Forms
Post by: howardpc on April 17, 2021, 05:38:17 pm
You might have changed the settings, but a default Lazarus IDE generates a backup subdirectory in each project directory.
If you have this, start by looking there.
Title: Re: Help: The Form has disappeared from View Project Forms
Post by: AL on April 17, 2021, 05:57:10 pm
If your program compile and run, the form/unit is still there.
Look in the project inspector (menu: project/project inspector) and try to re-add your .pas unit  and .lfm to the project.
Title: Re: Help: The Form has disappeared from View Project Forms
Post by: valter.home on April 17, 2021, 06:27:33 pm
I solved it by creating a new project, overwriting the .lfm file with that of my application, modifying some data in the .lpr file, setting File and Required Packages in the Project inspector and finally copying my units to the new project.
I had a bad time.
Thanks for your feedback.
Title: Re: [SOLVED] Help: The Form has disappeared from View Project Forms
Post by: wp on April 17, 2021, 07:09:08 pm
I've seen similar issues, and it fact it is very easy to destroy packages this way: Create a new project. Add a chart to the form. Suppose you want to look up something about TChart in the TAChart package - I ctrl-click on the identifier TChart in the editor to open the TAGraph unit. Then something happens to distract my attention, and I do not realize that the TAGraph unit is the active file in the editor. Now I want to save the new project: with TAGraph still active in the editor I select routinely select "File" > "Save As", navigate to the folder which should hold the new project, and enter a filename for the main form not realizing that I am writing TAGraph under a new name to a new location! I usually realize this issue in the next step when the IDE asks me whether the old TAGraph.pas should be deleted. But even if I say "no" - it's too late: the file already has been relocated!

So, always be at the highest level of attention when saving new files. The file to be saved must always be the active file in the editor!
Title: Re: [SOLVED] Help: The Form has disappeared from View Project Forms
Post by: valter.home on April 17, 2021, 08:15:01 pm
Quote
when the IDE asks me whether the old TAGraph.pas should be deleted

That's exactly what happened! But as you say it was too late...

Quote
The file to be saved must always be the active file in the editor!

Of course, it must be so, unfortunately I was distracted but this will never happen again. As always we learn from mistakes... but today it went really well, a lot of fear but I recovered everything.
TinyPortal © 2005-2018