Recent

Author Topic: 'ProjectTemplates': fixes and an idea for an improvement  (Read 6387 times)

eny

  • Hero Member
  • *****
  • Posts: 1588
'ProjectTemplates': fixes and an idea for an improvement
« on: July 31, 2009, 12:36:04 am »
Today I discovered the Lazarus component 'projecttemplates'.
It has a lot of potential, but it doesn't quite deliver (yet).
There are a number of open bugreports, the extension exceptions don't work and subdirectories are not supported. Caused by bugs or incomplete function bodies in the source (0.9.27).

The attachment shows suggestions for fixes to get it working.

Furthermore: it would be very helpful if the ProjName property would automatically be replaced in the source files (or by way of a parameter in the Projects.ini file to switch this on and off, to keep it backwards compatible).
At the moment one must manually edit the template files and insert __PROJNAME__ tags in several places. Making it impossible to maintain the templates via the IDE.
For demonstration purposes I've added a function SubstituteProjectReferences that does just that.
(I had to rename the sourcefile because .pp files cannot be uploaded.)

Just my 2 (euro-) cents...
All posts based on: Win10 (Win64); Lazarus 1.8.0 'stable' (#56594 win64) unless specified otherwise...

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: 'ProjectTemplates': fixes and an idea for an improvement
« Reply #1 on: July 31, 2009, 11:17:51 am »
Can you attach this to either an existing report, or create a new patch report (with references to exitisng reports) ?
Once read, things aren't tracked here anymore.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

eny

  • Hero Member
  • *****
  • Posts: 1588
Re: 'ProjectTemplates': fixes and an idea for an improvement
« Reply #2 on: July 31, 2009, 10:41:58 pm »
Will do.

One more question on this subject: after all files have been succesfully copied, I get an error message (see img). This is in the part where the IDE is instructed to load the new template file (I assume).
Something goes wrong in the method TTemplateProjectDescriptor.InitProject (IDETemplateProject.pp).

However I'm not an IDE expert.
Anyone out there who can tell me what's causing the error?
All posts based on: Win10 (Win64); Lazarus 1.8.0 'stable' (#56594 win64) unless specified otherwise...

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: 'ProjectTemplates': fixes and an idea for an improvement
« Reply #3 on: August 01, 2009, 02:58:41 am »
However I'm not an IDE expert.
Me neither
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: 'ProjectTemplates': fixes and an idea for an improvement
« Reply #4 on: August 02, 2009, 07:53:56 pm »
Today I discovered the Lazarus component 'projecttemplates'.
It has a lot of potential, but it doesn't quite deliver (yet).
There are a number of open bugreports, the extension exceptions don't work and subdirectories are not supported. Caused by bugs or incomplete function bodies in the source (0.9.27).

If you're having trouble getting a project template to work the way you want it to, you might try creating a package that adds a new project item to the IDE's File | New. This allows complete control over all aspects of a new project's settings and default code. Same for a new form unit. The only downside is that you have to recompile the IDE as you do with any package.

See extp_tk_20090801.zip in the Files section of this forum and look at files extp_proj_intf.pas and extp_proj.lpk. Using a package to add to File | New is one of the best kept secrets of Lazarus and also one of the most powerful features. Create your own new-project wizard!

http://groups.google.com/group/extpascal

I looked at project templates and gave up on them almost immediately. Then I discovered how to do it with a package and was able to accomplish everything I needed to do.

Thanks.

-Phil