Recent

Author Topic: Lazarus Cross-Platform Project  (Read 16493 times)

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Lazarus Cross-Platform Project
« Reply #45 on: April 07, 2018, 01:15:39 am »
Are you actively using your system on Windows also?

Look through the various app directories in the AppData directory under the C:\Users\loginname. I don't believe there is a standard for how config data is stored, despite what MS once hoped for. I think most developers actively try to avoid using the registry.

Having a separate file for preferences is a lot easier for the user. For example, to reset the state of an app, the user can just delete the app's .ini file (or on Mac, delete the app's .plist file in ~/Library/Preferences).

However, if you wanted to use the registry, it would be easy to switch to from an .ini file. I believe FPC has an INI-style interface to the registry, or you could easily write one.

I developed Windows desktop apps for many years, but like many developers I've moved on to just about everything except desktop apps (Web, server, dynamic libraries, etc.). Desktop app development is on a sharp downward spiral. Even MS knows this - see how they demoted Windows last week - the end of an era, for sure, unthinkable when I was doing desktop app development.

mijen67

  • Full Member
  • ***
  • Posts: 130
  • It's hard to beat the bandwidth of a flying DVD
Re: Lazarus Cross-Platform Project
« Reply #46 on: April 07, 2018, 01:34:37 am »
Desktop app development is on a sharp downward spiral. Even MS knows this - see how they demoted Windows last week - the end of an era, for sure, unthinkable when I was doing desktop app development.

And the reason for that? My take: It is easier for Industri to pull money from you if you have to subscribe to some service instead of just using a program. Hopefully Linux and similar will create an alternative to that trend.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Lazarus Cross-Platform Project
« Reply #47 on: April 07, 2018, 01:39:15 am »
Desktop app development is on a sharp downward spiral. Even MS knows this - see how they demoted Windows last week - the end of an era, for sure, unthinkable when I was doing desktop app development.

And the reason for that? My take: It is easier for Industri to pull money from you if you have to subscribe to some service instead of just using a program. Hopefully Linux and similar will create an alternative to that trend.

No, it's because the action is in mobile and Web now.

Linux desktop will never be relevant.

mijen67

  • Full Member
  • ***
  • Posts: 130
  • It's hard to beat the bandwidth of a flying DVD
Re: Lazarus Cross-Platform Project
« Reply #48 on: April 07, 2018, 09:09:43 am »
Desktop app development is on a sharp downward spiral. Even MS knows this - see how they demoted Windows last week - the end of an era, for sure, unthinkable when I was doing desktop app development.

And the reason for that? My take: It is easier for Industri to pull money from you if you have to subscribe to some service instead of just using a program. Hopefully Linux and similar will create an alternative to that trend.

No, it's because the action is in mobile and Web now.

Linux desktop will never be relevant.

Correction. The kids-stuff-action is in mobile and web now. Real stuff actions like technical drawing, design of electric circuits and pro-gaming will never enter mobile and web. 

mijen67

  • Full Member
  • ***
  • Posts: 130
  • It's hard to beat the bandwidth of a flying DVD
Re: Lazarus Cross-Platform Project
« Reply #49 on: April 07, 2018, 09:50:13 am »
Here's something I was working on earlier this summer. Realized today that summer is almost over and it's time to post this thing!

-Phil

Feature request:

When starting a new Cross-Platform Project user provides:

Application Name,
Project Name, (which often is a foldername friendly version of Application Name).
Bundle identifier
Creates Files in.

I would like to request the addition of three more items, so that the complete list becomes:

Application Name,
Project Name (foldername friendly version of Application Name).
Bundle identifier (Used on Mac only).
Creates Files in.
Vendor Name: Real name with spaces, lc and uc letters etc.   
Vendorfoldername: (Used on Windows/Linux only (I think?)). (Foldername friendly version of Vendorname)
Version number (initial): Major, Minor and Version.

And that the local path for configuration files on Windows and Linux becomes:
C:\Users\<username>\AppData\Local\vendorname\projectname\ 
~/.vendorname/projectname/

Reasons for adding vendor name and for grouping configuration files under vendor is:
- There is less stuff in ~/ and C:\Users\<username\AppData\Local
- If you (one vendor) work on several projects the files are grouped in one place.
- Sometimes you provide both an app and a hardware driver. By grouping under vendor they are more logically grouped.
- It's clear to newbies what the Vendor name of the app is (locally in the application as well as what the OS is told by installer and by application).

Reasons for adding version number.
- It helps newbies set a version number and it's clear what the version number of the app is set to - both locally in the app - as well as what the OS is told by installer and by application. 

mijen67

  • Full Member
  • ***
  • Posts: 130
  • It's hard to beat the bandwidth of a flying DVD
Re: Lazarus Cross-Platform Project
« Reply #50 on: April 07, 2018, 10:09:06 am »

Division by zero.
Pres OK to ignore and risk data corruption.
Press Abort to kill the program.


You did see the note in the File | New | Cross-Platform Desktop App description, right? "Important!  If Lazarus throws a "division by zero" exception after creating the new project, for now just click OK to ignore it."

This is a one-time thing for the project caused by a Lazarus bug - it doesn't seem to be able to open the project just created without throwing this error.

Have you worked with the Lazarus developers to solve this issue? Or other insiders that could help out?

Guessing:

Project Options -> Application: No titel is given. A title is given if you use the default project template. Could this cause an issue? I know it most likely has nothing to do with dividing by zero, but ...

Project Options -> Version Info: You enable "Include version info in executable", the default project template do not. Could you enter data and leave it disabled until it is needed later? There are numbers here ... maybe?

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Lazarus Cross-Platform Project
« Reply #51 on: April 07, 2018, 07:16:20 pm »
Reasons for adding version number.
- It helps newbies set a version number and it's clear what the version number of the app is set to - both locally in the app - as well as what the OS is told by installer and by application.

There's an entire project options tab in Lazarus devoted to setting version information. It doesn't really make sense to prompt for the version number when the project is created. No other IDE does this.

There is no "vendor" item in the version info resource, but perhaps CompanyName would do.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Lazarus Cross-Platform Project
« Reply #52 on: April 07, 2018, 10:45:54 pm »
Vendor Name: Real name with spaces, lc and uc letters etc.   
Vendorfoldername: (Used on Windows/Linux only (I think?)). (Foldername friendly version of Vendorname)
Version number (initial): Major, Minor and Version.

And that the local path for configuration files on Windows and Linux becomes:
C:\Users\<username>\AppData\Local\vendorname\projectname\ 
~/.vendorname/projectname/

The standard CompanyName in the version info resource should suffice for vendor name.

As for "Vendorfoldername", the issue is that there doesn't seem to be much consistency across apps. So I would suggest that you just pass into Load the path you want to use. That is, use TPreferencesList.DefaultLoad to use the default as now; use TPreferencesList.Load with your own path. See if that works for you.

For the curious (or those who don't know what we're talking about), here's a short travelogue of how various IDEs do it when creating a new project.

Here's Lazarus and Xcode. Not sure where those images show up with this primitive forum software. Note that Xcode does prompt for organization name, but that's probably because there isn't a standard key for that in the app's Info.plist file.

Due to last-century size limitations on images here, will add more in a second (or third) post.


Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Lazarus Cross-Platform Project
« Reply #53 on: April 07, 2018, 10:55:13 pm »
Due to last-century size limitations on images here, will add more in a second (or third) post.

Here's Visual Studio for Mac in two screenshots.

#1: Note how it shows what the app name will look like in the app's menu. How awesome is that?

#2: Note how they nicely separate the information into two dialogs. #1 asks for information about the app. #2 asks for file names and locations. #2 also shows the layout of the resulting project folder that it will create. Pretty nifty.

And finally Xamarin Studio on Windows. If it looks similar to VS for Mac, that's because VS for Mac is an updated and renamed version of Xam Studio.

Note how Xam Studio even on Windows asks for organization identifier and generates basically the equivalent of Mac's bundle ID, which they call "package name".

Mr.X

  • New member
  • *
  • Posts: 8
Re: Lazarus Cross-Platform Project
« Reply #54 on: February 11, 2019, 01:32:54 am »
Hi Phil and thank you for making this project!

(Please ignore my PM if you have answered here; I finally found this thread which has the missing instructions I needed. I am a complete Lazarus newb!)

I followed your instructions in this thread, but I am getting an error when trying to compile the LazXProj package. I have the Lazarus IDE installed on MacOS Mojave. I am targeting? Cocoa.

I am getting a compile error in the TLazXProjApplicationDescriptor.InitProject function in LazXProj_Intf

The line is:
Code: [Select]
TProject(AProject).CompilerOptions.ExecuteAfter.ShowAllMessages := True;and the error is:

Code: [Select]
lazxproj_intf.pas(156,51) Error: identifier idents no member "ShowAllMessages"

Mr.X

  • New member
  • *
  • Posts: 8
Re: Lazarus Cross-Platform Project
« Reply #55 on: February 12, 2019, 11:54:57 pm »
Commented out that line, but have a new problem now.

It's looking for LazarusPackageIntf ?