Recent

Author Topic: Unable to save projects correctly in Ubuntu 18.04  (Read 453 times)

KesterKick

  • New member
  • *
  • Posts: 7
Unable to save projects correctly in Ubuntu 18.04
« on: December 07, 2018, 02:48:21 pm »
Hi,
I am new to Lazarus but having graduated from Delphi 7, the programming is familiar.  I've set up Lazarus on a Windows 7 desktop computer and have been managing that with no major problems but have encountered problems on my Ubuntu 18.04 desktop.

While working within the program on the Ubuntu system, I can carry out the programming, test it and generally get it to work - the problem occurs when I try to save my projects.  I must be making some basic error somewhere but have been unable to identify what I am doing incorrectly.  I have used the same saving routines that have been successful in Lazarus on my Windows 7 desktop but they seem not to work on the Ubuntu machine.  The problem is, although everything appears to have been saved, when I load my project by double clicking the 'project1.lpi' file, the unit loads without its form.  I can see 'project1.lpi', 'project1.lpr', 'project1.lps', 'project1.res', 'unit1.lfm' and 'unit1.pas' are listed in the save location.

So what am I doing incorrectly?  I'd be grateful if experienced forum members could point me in the right direction.

Thanks.

Handoko

  • Hero Member
  • *****
  • Posts: 2676
  • My goal: build my own game engine using Lazarus
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #1 on: December 07, 2018, 04:56:44 pm »
Hello KesterKick,
Welcome to the forum.

You can open the form using Project Inspector
Lazarus main menu > Project > Project Inspector
then choose an unit that contain form, for example unit1.pas. Double click it to show the source code and then:
Lazarus main menu > View > Toggle Form/Unit View F12

Lazarus should work correctly on Ubuntu 18.04, I used it before. But if something wrong, you may need to reinstall it.

But I think it's probably something wrong with your project file or you don't know how to show the form. If you want, you can send the whole source code the forum, we will help you check it.

KesterKick

  • New member
  • *
  • Posts: 7
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #2 on: December 07, 2018, 05:27:07 pm »
Hi Handoko,

Thanks for your comments.  I've tried what you suggested but without success.  I can try reinstalling Lazarus to see if that helps.

As I said in my first post, I have no problems running Lazarus in Windows 7 so I don't think the problem is with my coding - in fact the program runs correctly during tests while I am programming within Lazarus.  The problem occurs after I save my my work, restart Lazarus and try to load my work.

lucamar

  • Sr. Member
  • ****
  • Posts: 463
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #3 on: December 07, 2018, 06:05:32 pm »
Sounds like there's something wrong with your .LFM

To discard a problem with Lazarus itself, try creating a new "Application" project and just saving it; then close Lazarus and click the .LPI to reopen. Does it fail as well with that bare project?
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 11..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

KesterKick

  • New member
  • *
  • Posts: 7
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #4 on: December 07, 2018, 08:38:14 pm »
Hi Lucomar,

I did uninstall and reinstall Lazarus but there was no improvement.

I've since tried a few very basic projects all with the same problem.  The latest (a simple add five, subtract five counter) worked OK while testing within Lazarus but failed to open correctly when clicking the *.LPI file.  A full set of files (project1.ico, project1.lpi, project1.lpr, project1.lps, project1.res, unit1.lfm, unit1.pas plus a backup directory containing copies of project1.lpi and project1.lps) was saved in my chosen save location.

Clicking project1.lpi opens the file as an xml.  Clicking unit1.pas does open in Lazarus but as a new file accompanied by a blank Form1.

Clicking unit1.lfm opens it as a plain text file, clicking project1.res gives an error (could not display ... etc.), clicking project1.lps opens it as an xml and clicking project1.lpr opens it as a plain text file.  The files that open as xml or plain text files do contain text indicating my original coding has been remembered.

jamie

  • Hero Member
  • *****
  • Posts: 967
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #5 on: December 07, 2018, 11:16:57 pm »
Using Lazarus IDS the lpr is the file you open within the IDE in the PROJECT menu...
PRoject:Open Project;

etc

lucamar

  • Sr. Member
  • ****
  • Posts: 463
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #6 on: December 08, 2018, 12:28:29 am »
Clicking project1.lpi opens the file as an xml.  Clicking unit1.pas does open in Lazarus but as a new file accompanied by a blank Form1.

Clicking unit1.lfm opens it as a plain text file, clicking project1.res gives an error (could not display ... etc.), clicking project1.lps opens it as an xml and clicking project1.lpr opens it as a plain text file.  The files that open as xml or plain text files do contain text indicating my original coding has been remembered.

Sounds like you have a conflict about which application should open which types of files. It happens :)

As a minimum, emergency meassure, you can use your file manager to change this. In Nautilus, for example, right-click in a .LPI file and select startlazarus or lazarus as the application to open it by default. See images for reference (in Spanish, sorry).

Using Lazarus IDS the lpr is the file you open within the IDE in the PROJECT menu...
PRoject:Open Project;

Ahh ... no, it's the LPI you open; after all it's where the references to the project's options and files are, in the Lazarus Project Information file. :)
« Last Edit: December 08, 2018, 12:32:56 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 11..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

KesterKick

  • New member
  • *
  • Posts: 7
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #7 on: December 08, 2018, 09:11:28 am »
Hi lucamar,

Thanks for your reply.  I tried what you suggested but the LPI file, although it opens in lazarus, opens as a new file with an empty form and no procedures listed.

lucamar

  • Sr. Member
  • ****
  • Posts: 463
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #8 on: December 08, 2018, 09:59:58 am »
Hi lucamar,

Thanks for your reply.  I tried what you suggested but the LPI file, although it opens in lazarus, opens as a new file with an empty form and no procedures listed.

Hummm ... This is all quite strange. I must confess that I've always found that all this is done automagically simply by installing Lazarus, although I do what I suggested to open with other apps (gedit, for example). Point is that if the project is saved right then clicking the LPI should open it without problems.

Try to open the LPI from the attached default project and tell me what happens.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 11..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

KesterKick

  • New member
  • *
  • Posts: 7
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #9 on: December 08, 2018, 01:08:14 pm »
Hi lucamar,
Thanks for your continued interest in my problem.

After extracting files from your zipped attachment, I rant he LPI file but got the same response I was getting from my own tests - Lazarus opened but the form was blank and the unit contained no procedures.

This is a mystery.

I'll attach one of my test files for you to look at.

Cheers for now.

lucamar

  • Sr. Member
  • ****
  • Posts: 463
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #10 on: December 08, 2018, 02:20:00 pm »
After extracting files from your zipped attachment, I rant he LPI file but got the same response I was getting from my own tests - Lazarus opened but the form was blank and the unit contained no procedures.

Yes, that's OK, it's an empty "default" project. I just did a "New Project->Application" and savd it. The important thing is that it opened the project right: the form, the correspondig unit in the editor, etc. Right?

Quote
This is a mystery.

I'll attach one of my test files for you to look at.

I'll give it a look after dinner and report back. Don't despair! ;D

OK, I'm back. Tested your project ... and it works fine! I did nothing more than unzip and click the LPI, and the attached image is the result. Have you tried it? I mean, doing just what I have just done: unzip to a new folder, etc. It should work!
« Last Edit: December 08, 2018, 03:10:37 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 11..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

KesterKick

  • New member
  • *
  • Posts: 7
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #11 on: December 08, 2018, 03:36:04 pm »
Hi lucamar,

I tried my test application before zipping prior attachment to my last post - it would not open as it has for you but shows just a blank form and unit with no procedures.

It looks like there's a problem with my Ubuntu and not my usage of Lazarus.  As I've said in my initial post, I have no such problem on my Windows 7 desktop.

This is not going to be easy to resolve I think.

Cheers and thanks for the help.

lucamar

  • Sr. Member
  • ****
  • Posts: 463
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #12 on: December 08, 2018, 05:32:36 pm »
Try just one thing more ... well, two things:
  • While in Lazarus select "Project->Close project" and in the dialog that appears click "Quit Lazarus". Then try again to click your LPI to (re)open the projecti
  • While in Lazarus, again, select "Project->Open project"; then in the fie dialog navigate to your project's folder and open it.

If any of those works at least you'll have a workaround while we try to ascertain what's happening. Although I must confess I'm quite lost with this ...  :-[
« Last Edit: December 08, 2018, 05:34:14 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 11..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

Handoko

  • Hero Member
  • *****
  • Posts: 2676
  • My goal: build my own game engine using Lazarus
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #13 on: December 08, 2018, 05:53:07 pm »
I can reproduce KesterKick's issue on my Ubuntu Mate 18.10 Lazarus 1.8.4.

... I rant he LPI file but got the same response I was getting from my own tests - Lazarus opened but the form was blank and the unit contained no procedures.
Not exactly. Actually it opened the previous project. So if you previously started an empty project, after double clicking the lpi or lpr file, your Lazarus will open the (previous) blank project. It happened on my test. But if I previously opened my own project, then if I double click on your Test 03 project, it will open my previously opened project.

Some finding after doing some tests:
- The issue only happened on your Test 03 source code
- On my projects, it behaves correctly
- The issue won't happen if you use File > Open

KesterKick

  • New member
  • *
  • Posts: 7
Re: Unable to save projects correctly in Ubuntu 18.04
« Reply #14 on: December 09, 2018, 11:21:38 am »
Hi lucamar and Handoko,

Both your suggestions have proved very helpful and provided practical workarounds.  I can now edit my programs, compile them and create executable files - useful progress for me so many thanks to you both.