[Lazarus] How to add your own 'New Project' template?

Tom Verhoeff T.Verhoeff at tue.nl
Tue Aug 19 23:57:53 CEST 2008


On Mon, Aug 18, 2008 at 05:32:17PM +0200, Michael Van Canneyt wrote:
> 
> On Mon, 18 Aug 2008, Tom Verhoeff wrote:
> 
> > Where can one find the article?  Or is this the same as the README.txt
> > in components/projecttemplates?
> 
> It's at home, I'll send it in private. I'm not allowed to publish
> everything.
> 
> The article explains how to add custom objects to the file|New dialog, and
> uses the templates package as an example.

I would appreciate receiving the article.

I am working on a sample, but I am not yet satisfied with my understanding.

Note that I will be using Lazarus this year in our first-year
programming education.  Others will view this as a test case for Lazarus.

I have a few more questions/remarks:

 1. What is the default location for the project templates?

I know the user can change it.  However, in my case, the
users are novice students.  I would like to have the least hassle
in giving them a template.  So if I can avoid the need for them
to set options, that would be preferred.  I still need to see to it
that the template gets copied to the appropriate location.

 2. I have some improvements for the README.txt in components/projecttemplates/
    Can I mail a new version to you?

 3. Why are the "built-in" 'New Project' options, such as Custom Program,
    not handled via the template mechanism?  An example template would
be helpful.

 4. Tools > Project template options opens a dialog window titled
    Project template settings.  Naming is incosistent (options vs. settings).

 5. Do released (stable) builds of Lazarus always include
    the projects templates package?  Version 0.9.24 does.
That way, the user (our students) need not be bothered with
package installation.

 6. When creating a New Project from a template, a dialog window appears
    to set the project name and the directory name, and also to
set additional variables.

When I tried this, even though my template did not contain additional
variables, the dialog says "This project contains additional
variables. ...", but the list below it is empty.  Is this is a bug?
Anyway, it is confusing (especially to novices; maybe templates
are not what I want to use after all).

 7. It is not clear to me what the requirements are for naming files
    in the template, and how these names get changed when the template
is instantiated.  Should I put files like project.ini, project.lpi,
project.pas, unit1.pas in the template directory, and will
project.{lpi,pas} be renamed depending on the name chosen by
the user when instantiating the template?  That is, are there
more substitutions than just for the occurrences of $(varname)
in non-Exluded files, viz. file name changes?

 8. On a quite different note, it is somewhat of a hassle that Lazarus
    insists on opening a project.  Actually, after some pushing, it will
open a "plain" Pascal program file and run it.

It would be helpful to simplify this.  I want to minimize the
threshold for newcomers.  My course starts off with bare console
applications, contained in a single file (program ... begin ... end.)
Now, they are forced to create projects (though that has some
advantage, in that it saves options etc.)

Thanks,

	Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL     | Dept. of Math. & Comp. Science
PHONE:  +31 40 247 41 25        | Technische Universiteit Eindhoven
FAX:    +31 40 247 54 04        | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands



More information about the Lazarus mailing list