Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-08

Lazreport, again.

37 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

hi,

I keep getting the following errors in Lazarus when trying to design a report:

Gdk-CRITICAL **: file gdkwindow.c: line 727 (gdk_window_unref): assertion `private->ref_count > 0' failed. TCustomForm.SetActiveControl frDesignerForm:TfrDesignerForm AWinControl=ValueEdit:TEdit GetParentForm(AWinControl)=frDesignerForm:TfrDesignerForm csLoading=False AWinControl.CanFocus=False IsControlVisible=True Enabled=True TApplication.HandleException Cannot focus a disabled or invisible window Stack trace:
$00000000006F4476 line 1278 of include/customform.inc $00000000006F1802 line 108 of include/customform.inc $0000000000832941 line 4913 of include/wincontrol.inc $0000000000A01973 line 1802 of objectinspector.pp
$0000000000A01F5A line 1932 of objectinspector.pp
$0000000000840044 line 3202 of include/control.inc $00000000006DB279
$000000000083C33E line 1583 of include/control.inc $0000000000831F90 line 4715 of include/wincontrol.inc $00000000009264F0 line 3543 of gtkproc.inc
$0000000000932719 line 1094 of gtkcallback.inc
$000000000093289F line 1172 of gtkcallback.inc

Lazarus from today, x86_64, linux, GTK 1.

Steps to reproduce:
- Install lazreport package
- Drop tfrreport on form
- Select 'Design report' from context menu
- Drop band on report.
- Move the fastreport object inspector around...
-> Above error.

A second way of getting this is simply trying to expand the 'Font' editor in the fastreport object inspector.

I've been playing about with it for a couple of hours, and start wondering if anyone has ever been able to make a working report with it, it is extremely unstable... ?

Michael.

Reply by email

Jesus Reyes
to Michael Van Canneyt

--- El dom 17-ago-08, Michael Van Canneyt escribi?:

Show quoted text 57 lines
De:: Michael Van Canneyt Asunto: [Lazarus] Lazreport, again. A: "Lazarus mailing list" Fecha: domingo, 17 agosto, 2008, 6:54 am hi, I keep getting the following errors in Lazarus when trying to design a report: Gdk-CRITICAL **: file gdkwindow.c: line 727 (gdk_window_unref): assertion `private->ref_count > 0' failed. TCustomForm.SetActiveControl frDesignerForm:TfrDesignerForm AWinControl=ValueEdit:TEdit GetParentForm(AWinControl)=frDesignerForm:TfrDesignerForm csLoading=False AWinControl.CanFocus=False IsControlVisible=True Enabled=True TApplication.HandleException Cannot focus a disabled or invisible window Stack trace: $00000000006F4476 line 1278 of include/customform.inc $00000000006F1802 line 108 of include/customform.inc $0000000000832941 line 4913 of include/wincontrol.inc $0000000000A01973 line 1802 of objectinspector.pp $0000000000A01F5A line 1932 of objectinspector.pp $0000000000840044 line 3202 of include/control.inc $00000000006DB279 $000000000083C33E line 1583 of include/control.inc $0000000000831F90 line 4715 of include/wincontrol.inc $00000000009264F0 line 3543 of gtkproc.inc $0000000000932719 line 1094 of gtkcallback.inc $000000000093289F line 1172 of gtkcallback.inc Lazarus from today, x86_64, linux, GTK 1. Steps to reproduce: - Install lazreport package - Drop tfrreport on form - Select 'Design report' from context menu - Drop band on report. - Move the fastreport object inspector around... -> Above error. A second way of getting this is simply trying to expand the 'Font' editor in the fastreport object inspector. I've been playing about with it for a couple of hours, and start wondering if anyone has ever been able to make a working report with it, it is extremely unstable... ? Michael. _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

__________________________________________________ Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ?gratis! Reg?strate ya - http://correo.yahoo.com.mx/

Reply by email

Jesus Reyes
to Michael Van Canneyt: I keep getting the following errors in Lazarus when trying to design a report:…

--- El dom 17-ago-08, Michael Van Canneyt escribi?:

Show quoted text 51 lines
De:: Michael Van Canneyt Asunto: [Lazarus] Lazreport, again. A: "Lazarus mailing list" Fecha: domingo, 17 agosto, 2008, 6:54 am hi, I keep getting the following errors in Lazarus when trying to design a report: Gdk-CRITICAL **: file gdkwindow.c: line 727 (gdk_window_unref): assertion `private->ref_count > 0' failed. TCustomForm.SetActiveControl frDesignerForm:TfrDesignerForm AWinControl=ValueEdit:TEdit GetParentForm(AWinControl)=frDesignerForm:TfrDesignerForm csLoading=False AWinControl.CanFocus=False IsControlVisible=True Enabled=True TApplication.HandleException Cannot focus a disabled or invisible window Stack trace: $00000000006F4476 line 1278 of include/customform.inc $00000000006F1802 line 108 of include/customform.inc $0000000000832941 line 4913 of include/wincontrol.inc $0000000000A01973 line 1802 of objectinspector.pp $0000000000A01F5A line 1932 of objectinspector.pp $0000000000840044 line 3202 of include/control.inc $00000000006DB279 $000000000083C33E line 1583 of include/control.inc $0000000000831F90 line 4715 of include/wincontrol.inc $00000000009264F0 line 3543 of gtkproc.inc $0000000000932719 line 1094 of gtkcallback.inc $000000000093289F line 1172 of gtkcallback.inc Lazarus from today, x86_64, linux, GTK 1. Steps to reproduce: - Install lazreport package - Drop tfrreport on form - Select 'Design report' from context menu - Drop band on report. - Move the fastreport object inspector around... -> Above error. A second way of getting this is simply trying to expand the 'Font' editor in the fastreport object inspector. I've been playing about with it for a couple of hours, and start wondering if anyone has ever been able to make a working report with it, it is extremely unstable... ?

The problem above was introduced in latest patch of LazReport, IMO it works much better now but it doesn't mean that everything it's working all fine, and the true is that some times while fixing something another one get bad side effects, lack of time to test on all widgetsets which doesn't work exactly the same on every single detail makes difficult to track down all flaws. Also, I don't agree that it's "extremely unstable" but I do agree that it doesn't work all good in all widgetsets, yet.

For the moment this one should fixed in r16090.

Michael.

Jesus Reyes A.

__________________________________________________ Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ?gratis! Reg?strate ya - http://correo.yahoo.com.mx/

Reply by email

Michael Van Canneyt
to Jesus Reyes
Jesus Reyes wrote 8 lines
> > I've been playing about with it for a couple of hours, > and start wondering if anyone has > ever been able to make a working report with it, it is > extremely unstable... ? The problem above was introduced in latest patch of LazReport, IMO it works much better now but it doesn't mean that everything it's working all fine, and the true is that some times while fixing something another one get bad side effects, lack of time to test on all widgetsets which doesn't work exactly the same on every single detail makes difficult to track down all flaws. Also, I don't agree that it's "extremely unstable" but I do agree that it doesn't work all good in all widgetsets, yet.

I haven't been able to create a single report, dropping a band on the report is simply impossible. I tried during the whole day, and got nowhere, hence my impression that it is very unstable... :(

For the moment this one should fixed in r16090.

Thank you very much,
I will test tomorrow. Hopefully it will be better :-)

Michael.

Reply by email

Michael Van Canneyt
to Mattias Gärtner
Mattias G?rtner wrote 31 lines
Zitat von Michael Van Canneyt : > > > On Sun, 17 Aug 2008, Jesus Reyes wrote: > > > > > > > I've been playing about with it for a couple of hours, > > > and start wondering if anyone has > > > ever been able to make a working report with it, it is > > > extremely unstable... ? > > > > The problem above was introduced in latest patch of LazReport, IMO it works > much better now but it doesn't mean that everything it's working all fine, > and the true is that some times while fixing something another one get bad > side effects, lack of time to test on all widgetsets which doesn't work > exactly the same on every single detail makes difficult to track down all > flaws. Also, I don't agree that it's "extremely unstable" but I do agree that > it doesn't work all good in all widgetsets, yet. > > > > I haven't been able to create a single report, dropping a band on the > report is simply impossible. I tried during the whole day, and got nowhere, > hence my impression that it is very unstable... :( > > > For the moment this one should fixed in r16090. > > Thank you very much, > I will test tomorrow. Hopefully it will be better :-) I fixed a gtk1 bug and improved the laz report object inspector moving.

Well, now I have high expectations for my testing tonight :)

Michael.

Reply by email

Mattias Gärtner
to Michael Van Canneyt

Zitat von Michael Van Canneyt :

Show quoted text 42 lines
[...] On Mon, 18 Aug 2008, Mattias G??rtner wrote: > Zitat von Michael Van Canneyt : > > > > > > > On Sun, 17 Aug 2008, Jesus Reyes wrote: > > > > > > > > > > I've been playing about with it for a couple of hours, > > > > and start wondering if anyone has > > > > ever been able to make a working report with it, it is > > > > extremely unstable... ? > > > > > > The problem above was introduced in latest patch of LazReport, IMO it works > > much better now but it doesn't mean that everything it's working all fine, > > and the true is that some times while fixing something another one get bad > > side effects, lack of time to test on all widgetsets which doesn't work > > exactly the same on every single detail makes difficult to track down all > > flaws. Also, I don't agree that it's "extremely unstable" but I do agree that > > it doesn't work all good in all widgetsets, yet. > > > > > > > I haven't been able to create a single report, dropping a band on the > > report is simply impossible. I tried during the whole day, and got nowhere, > > hence my impression that it is very unstable... :( > > > > > For the moment this one should fixed in r16090. > > > > Thank you very much, > > I will test tomorrow. Hopefully it will be better :-) > > I fixed a gtk1 bug and improved the laz report object inspector moving. Well, now I have high expectations for my testing tonight :)

:)
Keep in mind that gtk1 does not automatically capture the mouse like gtk2. This means, if you drag too fast under gtk1 the lazreport OI will stop moving until you move the move back over the OI.
I didn't test under 64bit.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gärtner
Mattias G?rtner wrote 49 lines
Zitat von Michael Van Canneyt : >[...] > > On Mon, 18 Aug 2008, Mattias G??rtner wrote: > > > Zitat von Michael Van Canneyt : > > > > > > > > > > > On Sun, 17 Aug 2008, Jesus Reyes wrote: > > > > > > > > > > > > > I've been playing about with it for a couple of hours, > > > > > and start wondering if anyone has > > > > > ever been able to make a working report with it, it is > > > > > extremely unstable... ? > > > > > > > > The problem above was introduced in latest patch of LazReport, IMO it > works > > > much better now but it doesn't mean that everything it's working all > fine, > > > and the true is that some times while fixing something another one get > bad > > > side effects, lack of time to test on all widgetsets which doesn't work > > > exactly the same on every single detail makes difficult to track down all > > > flaws. Also, I don't agree that it's "extremely unstable" but I do agree > that > > > it doesn't work all good in all widgetsets, yet. > > > > > > > > > > I haven't been able to create a single report, dropping a band on the > > > report is simply impossible. I tried during the whole day, and got > nowhere, > > > hence my impression that it is very unstable... :( > > > > > > > For the moment this one should fixed in r16090. > > > > > > Thank you very much, > > > I will test tomorrow. Hopefully it will be better :-) > > > > I fixed a gtk1 bug and improved the laz report object inspector moving. > > Well, now I have high expectations for my testing tonight :) :) Keep in mind that gtk1 does not automatically capture the mouse like gtk2. This means, if you drag too fast under gtk1 the lazreport OI will stop moving until you move the move back over the OI.

Ah...
Luckily my brain does not work so fast that I could drag faster than GTK1 :-)

I didn't test under 64bit.

Well, tonight it'll be tested under 64 bit :-)

Michael.

Reply by email

Tom Verhoeff
to Michael Van Canneyt

How can you add your own template to be available for use when creating a new project?

I would like to include a variation on Custom Program.

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

Reply by email

Graeme Geldenhuys
to Tom Verhoeff
Tom Verhoeff wrote
How can you add your own template to be available for use when creating a new project? I would like to include a variation on Custom Program.

I don't know if there is actual documentation on the steps...

What I did was to look at a rather simple example and customized it to my needs. Have a look it the following location.

<lazarus>/components/fpcunit/ide/

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Tom Verhoeff
to Michael Van Canneyt: I have an article describing this, or you can use the project templates (which is…
Michael Van Canneyt wrote 10 lines
On Mon, 18 Aug 2008, Tom Verhoeff wrote: > How can you add your own template to be available for use when creating > a new project? > > I would like to include a variation on Custom Program. I have an article describing this, or you can use the project templates (which is actually what the article describes)

Where can one find the article? Or is this the same as the README.txt in components/projecttemplates?

Thanks for the pointers,

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

Reply by email

Graeme Geldenhuys
to Mattias Gärtner: An embedded and charset-unspecified text was scrubbed... Name: not available Url:…
Mattias G?rtner wrote
See components/projecttemplates/README.txt

I've never actually tried that?until now. That is a brilliant idea and it works so well! Yet again I learnt something new about Lazarus IDE. :-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Mattias Gärtner: An embedded and charset-unspecified text was scrubbed... Name: not available Url:…
Mattias G?rtner wrote
See components/projecttemplates/README.txt

Hi Mattias,

I'm playing a bit more with the project templates. How is the project.ini file supposed to look like. I read the readme file and created it as best, but Recurse doesn't work and neither does Exclude.

Here is my project.ini file

-------------------[ project.ini ]----------------------- [Project]
Name=fpGUI Application (single file)
Author=Graeme Geldenhuys
Description=A simple single file GUI project.
Recurse=1
Exclude=.txt,.lps
----------------------[ end ]----------------------

My project template directory contains a subdirecty, but no files (it will be the unit output directory). I then thought maybe any subdirectories must contain files, so I created a blank "placeholder.txt" file, but still my subdirectory is not copied.

Also did I get the Exclude correct? The readme file is very vague on the format.
eg:
*.txt,*.lps
or
.txt,.lps
or
txt,lps

Mayby the "components/templateproject" should contain a sample directory or zip file showing a template of the template project. :-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys: On Mon, Aug 18, 2008 at 4:16 PM, Mattias G?rtner I've never actually tried that?until…
Show quoted text 12 lines
On Mon, 18 Aug 2008, Graeme Geldenhuys wrote: > On Mon, Aug 18, 2008 at 4:16 PM, Mattias G?rtner wrote: > > See components/projecttemplates/README.txt I've never actually tried that?until now. That is a brilliant idea and it works so well! Yet again I learnt something new about Lazarus IDE. :-)

Since I am the implementor, I'm of course very glad to hear you say this :-)

But honest is honest, the idea I got from RemObjects, which uses a similar idea in Delphi. So only half the credit is mine :-)

Michael.

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys: On Mon, Aug 18, 2008 at 4:16 PM, Mattias G?rtner I'm playing a bit more with the project…
Show quoted text 24 lines
On Mon, 18 Aug 2008, Graeme Geldenhuys wrote: > On Mon, Aug 18, 2008 at 4:16 PM, Mattias G?rtner wrote: > > See components/projecttemplates/README.txt Hi Mattias, I'm playing a bit more with the project templates. How is the project.ini file supposed to look like. I read the readme file and created it as best, but Recurse doesn't work and neither does Exclude. Here is my project.ini file -------------------[ project.ini ]----------------------- [Project] Name=fpGUI Application (single file) Author=Graeme Geldenhuys Description=A simple single file GUI project. Recurse=1 Exclude=.txt,.lps

This should be correct.

Note that excluded files are simply copied, they're just not parsed.

Concerning recurse:

line 405 of ProjectTemplates.pp contains

    If (FindFirst(Dir+'*',0,Info)0) then
that should be
    If (FindFirst(Dir+'*',0,Info)=0) then

Mattias, should I send a patch, or commit directly ?

Michael.

Reply by email

Michael Van Canneyt
to Tom Verhoeff: Where can one find the article? Or is this the same as the README.txt in…
Tom Verhoeff wrote 14 lines
On Mon, Aug 18, 2008 at 04:03:39PM +0200, Michael Van Canneyt wrote: > > On Mon, 18 Aug 2008, Tom Verhoeff wrote: > > > How can you add your own template to be available for use when creating > > a new project? > > > > I would like to include a variation on Custom Program. > > I have an article describing this, or you can use the project templates > (which is actually what the article describes) 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.

Michael.

Reply by email

Mattias Gärtner
to Michael Van Canneyt: This should be correct. Note that excluded files are simply copied, they're just not…

Zitat von Michael Van Canneyt :

Show quoted text 39 lines
> > > On Mon, 18 Aug 2008, Graeme Geldenhuys wrote: > > > On Mon, Aug 18, 2008 at 4:16 PM, Mattias G??rtner > wrote: > > > > See components/projecttemplates/README.txt > > Hi Mattias, > > I'm playing a bit more with the project templates. How is the > project.ini file supposed to look like. I read the readme file and > created it as best, but Recurse doesn't work and neither does Exclude. > > Here is my project.ini file > > -------------------[ project.ini ]----------------------- > [Project] > Name=fpGUI Application (single file) > Author=Graeme Geldenhuys > Description=A simple single file GUI project. > Recurse=1 > Exclude=.txt,.lps This should be correct. Note that excluded files are simply copied, they're just not parsed. Concerning recurse: line 405 of ProjectTemplates.pp contains If (FindFirst(Dir+'*',0,Info)0) then that should be If (FindFirst(Dir+'*',0,Info)=0) then Mattias, should I send a patch, or commit directly ?

Both. Send the patch directly to svn.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gärtner
Mattias G?rtner wrote 12 lines
> Concerning recurse: > > line 405 of ProjectTemplates.pp contains > > If (FindFirst(Dir+'*',0,Info)0) then > > that should be > If (FindFirst(Dir+'*',0,Info)=0) then > > Mattias, should I send a patch, or commit directly ? Both. Send the patch directly to svn.

Well, the fuzzy logic unit in my brain interpreted this as a 'please commit directly' so rev 16125 contains the fix. I changed the '*' to an AllFilesMask while I .

Reply by email

Michael Van Canneyt
to Michael Van Canneyt: Ah... Luckily my brain does not work so fast that I could drag faster than GTK1 :-) Well,…
Michael Van Canneyt wrote 20 lines
> > > > > For the moment this one should fixed in r16090. > > > > > > > > Thank you very much, > > > > I will test tomorrow. Hopefully it will be better :-) > > > > > > I fixed a gtk1 bug and improved the laz report object inspector moving. > > > > Well, now I have high expectations for my testing tonight :) > > :) > Keep in mind that gtk1 does not automatically capture the mouse like gtk2. This > means, if you drag too fast under gtk1 the lazreport OI will stop moving until > you move the move back over the OI. Ah... Luckily my brain does not work so fast that I could drag faster than GTK1 :-) > I didn't test under 64bit. Well, tonight it'll be tested under 64 bit :-)

I am very happy to confirm that the bug is fixed, and that all works as expected. And it seems I can drag faster than GTK1 can follow :-)

My thanks to Jesus and Mattias for the fast response.

After working a bit with it, as far as I can see, there are 3 issues:

1. Object inspector cannot be resized
2. Visibility of object inspector is lost after sessions (i.e. i must enable it each time)
3. Page margins are not taken into a account. They are drawn in the designer, but all objects fall outside the margins anyway.

Other than that, I've been able to make 2 reports already, without real problems. Nice work !

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: This should be correct. Note that excluded files are simply copied, they're just not…

2008/8/18 Michael Van Canneyt :

Show quoted text 6 lines
> Recurse=1 > Exclude=.txt,.lps This should be correct. Note that excluded files are simply copied, they're just not parsed.

Ah, I wrongly interpreted the readme file then. Maybe I scanned through it to quickly. :-)

that should be If (FindFirst(Dir+'*',0,Info)=0) then Mattias, should I send a patch, or commit directly ?

Always glad to test and report issues. ;-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: Since I am the implementor, I'm of course very glad to hear you say this :-) But honest…

2008/8/18 Michael Van Canneyt :

Since I am the implementor, I'm of course very glad to hear you say this :-)

Excellent work as always!

But honest is honest, the idea I got from RemObjects, which uses a similar idea in Delphi. So only half the credit is mine :-)

You are not the first person to borrow ideas from others... GExperts was a great source of ideas for me. ;-) The important thing is what you do with those ideas!

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Tom Verhoeff
to Michael Van Canneyt: It's at home, I'll send it in private. I'm not allowed to publish everything. The article…
Michael Van Canneyt wrote 11 lines
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

Reply by email

Graeme Geldenhuys
to Tom Verhoeff
Tom Verhoeff wrote
1. What is the default location for the project templates?

Under my system (Linux) in was $HOME/.lazarus/templates/

From this I gather it defaults to wherever the Lazarus settings folder

is plus the templates directory. Obviously this location is customizable via Tools | "Project template options".

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.

Oh, and on my system the label captions don't fit and even if I resize the dialog, only the edit boxes resize, the captions always stay partially visible. Lazarus compiled with GTK1.

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,

Yes

and will project.{lpi,pas} be renamed depending on the name chosen by the user when instantiating the template?

Good question! I was wondering the same thing and it seems it doesn't rename the files. They are copied as-is. Which makes we wonder what the Project Name variable is used for?

I know in Pascal you can't rename the unit or program name inside the file and yet the file itself still has the old name. I always thought this strange of Pascal, but that's the rules of Pascal! Physical filename and 'program' or 'unit' line must match.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Mattias Gärtner
Mattias G?rtner wrote
Note: The program name and the program filename can differ. And unit names and filenames can differ with -Un switch.

Never knew that.... Though in my defence, I have never seen anybody use it like that. ;-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Tom Verhoeff
to Graeme Geldenhuys: Under my system (Linux) in was $HOME/.lazarus/templates/ is plus the templates directory.…
Graeme Geldenhuys wrote 5 lines
On 8/19/08, Tom Verhoeff wrote: > > 1. What is the default location for the project templates? Under my system (Linux) in was $HOME/.lazarus/templates/

Under Windows (which I use rarely, but our students do), it is

C:\lazarus\templates

where Lazarus itself is installed in C:\lazarus\. The ...\templates directory does not even exist.

>From this I gather it defaults to wherever the Lazarus settings folder is plus the templates directory. ...

Apparently not on Windows.

Show quoted text 7 lines
> 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. Oh, and on my system the label captions don't fit and even if I resize the dialog, only the edit boxes resize, the captions always stay partially visible. Lazarus compiled with GTK1.

Same on Windows and Mac.

Show quoted text 6 lines
> 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, Yes

Is this a yes to that they need to be named project.lpi, or could it also be demo.lpi?

Show quoted text 7 lines
> and will > project.{lpi,pas} be renamed depending on the name chosen by > the user when instantiating the template? Good question! I was wondering the same thing and it seems it doesn't rename the files. They are copied as-is. Which makes we wonder what the Project Name variable is used for?

That is exactly what I want to understand.

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

Reply by email

Vincent Snijders
to Tom Verhoeff
Tom Verhoeff wrote 17 lines
On Wed, Aug 20, 2008 at 12:43:31PM +0200, Graeme Geldenhuys wrote: > On 8/19/08, Tom Verhoeff wrote: >> 1. What is the default location for the project templates? > Under my system (Linux) in was $HOME/.lazarus/templates/ Under Windows (which I use rarely, but our students do), it is C:\lazarus\templates where Lazarus itself is installed in C:\lazarus\. The ...\templates directory does not even exist. > >From this I gather it defaults to wherever the Lazarus settings folder > is plus the templates directory. ... Apparently not on Windows.

With lazarus 0.9.24, c:\lazarus is the settings folder. Lazarus 0.9.25+ has the settings folder in %LOCALAPPDATA%\lazaus, e.g. C:\Documents and Settings\Vincent Snijders\Local Settings\Application Data\lazarus

Vincent

Reply by email

Graeme Geldenhuys
to Tom Verhoeff: Under Windows (which I use rarely, but our students do), it is C:\lazarus\templates where…
Tom Verhoeff wrote 8 lines
> Under my system (Linux) in was $HOME/.lazarus/templates/ Under Windows (which I use rarely, but our students do), it is C:\lazarus\templates where Lazarus itself is installed in C:\lazarus\. The ...\templates directory does not even exist.

Neither did it under Linux. I manually created the templates directory.

> >From this I gather it defaults to wherever the Lazarus settings folder > is plus the templates directory. ... Apparently not on Windows.

As Vincent mentioned... In the latest "released" Lazarus, the settings folder is the same as the installed folder: In your case C:\Lazarus directory. I believe in the next Lazarus release it will use "\Document and Settings\<user>\<not sure where>" even though Lazarus is installed in C:\Lazarus\

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Tom Verhoeff: I would appreciate receiving the article. I am working on a sample, but I am not yet…
Tom Verhoeff wrote 14 lines
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.

(article sent in private)

Show quoted text 9 lines
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?

Primary lazarus configuration dir + templates.

What exactly the primary lazarus configuration dir is, depends on the system. For unix, this is ~/.lazarus, I don't know what it is for windows.

Show quoted text 9 lines
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?

Please do.

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.

Project templates were implemented WAY after the File|new mechanism :-)

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

If the lazarus team tells me what to change it to, I'll be glad to do so. I was not aware of any conventions.

Show quoted text 5 lines
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.

This is a question for the Lazarus team.

Show quoted text 10 lines
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).

The list always contains 2 variables, $(ProjName) and $(ProjDir), but these are handled specially.

This can be improved on. Feel free to make suggestions.

Show quoted text 8 lines
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?

No. Any substitution must be marked as such. There are no 'special' cases, but if you want to send some patches to handle this, let me know.

I suggest you read the articles I sent first, it should give you a better understanding of how it happens.

Michael.

Reply by email

Michael Van Canneyt
to Mattias Gärtner
Mattias G?rtner wrote 23 lines
Zitat von Michael Van Canneyt : >[...] > > 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. > > Project templates were implemented WAY after the File|new mechanism :-) 'Custom Program' is for bare sources, because many automatic features of the IDE are turned off. This is useful for example for sources created/edited by other IDEs and lazarus should only be a better text editor. > > 4. Tools > Project template options opens a dialog window titled > > Project template settings. Naming is incosistent (options vs. > settings). > > If the lazarus team tells me what to change it to, I'll be glad to do so. > I was not aware of any conventions. The term 'settings' is hardly used in lazarus. lazarus uses 'options' like Delphi.

I'll change it.

Show quoted text 11 lines
> > 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. > > This is a question for the Lazarus team. 0.9.26 will include it and 0.9.28 very probably too. It will be be included as long someone maintains it.

No problem, then, because I do :-)

Michael.

Reply by email

Tom Verhoeff
to Michael Van Canneyt: (article sent in private) Primary lazarus configuration dir + templates. What exactly the…
Michael Van Canneyt wrote 12 lines
> > 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? No. Any substitution must be marked as such. There are no 'special' cases, but if you want to send some patches to handle this, let me know.

What you mention concerns substitutions _inside_ the (text) files. What I was aiming at is substitutions of the _names_ of files being copied. Assuming we have in project.ini:

[Project]
Name=Special
Author=Tom
Description=A special FreePascal program.
Recurse=0
Exclude=.lrs

[Variables]
special=Example

Using the template below on the left creating a new project with project name 'my_new_proj' in directory 'My New Project', you get the instance on the right:

Template dir Transformation Instantiated dir
------------ -------------- ----------------
project.ini not copied
project.lpi substituted my_new_proj.lpi
project.lpr substituted my_new_proj.lpr
main.pas substituted main.pas
main.dfm substituted main.dfm
main.lrs copied as is main.lrs
aux.pas substituted aux.pas

where 'substituted' means that in the contents of the file, the following substitutions are carried through while copying:

$(ProjName) -> my_new_proj
$(ProjDir) -> My New Project
$(special) -> Example

In the README for components/projecttemplates is says:

During the copy, the package will scan the file/directory names and the contents of the files for variable substitution: $(VARNAME) will be replaced by the value of a variable $(VARNAME).

This suggests that substitutions are also done for file names (as well as the file contents). But how should one name the files, to get their names substituted? Should they rather be called

$(ProjName).lpi
$(ProjName).lpr

This is rather awkward for a file name. Please confirm.

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

Reply by email

Michael Van Canneyt
to Tom Verhoeff
Tom Verhoeff wrote 63 lines
On Fri, Aug 22, 2008 at 09:25:23AM +0200, Michael Van Canneyt wrote: > > > > 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? > > No. Any substitution must be marked as such. There are no 'special' > cases, but if you want to send some patches to handle this, let me know. What you mention concerns substitutions _inside_ the (text) files. What I was aiming at is substitutions of the _names_ of files being copied. Assuming we have in project.ini: [Project] Name=Special Author=Tom Description=A special FreePascal program. Recurse=0 Exclude=.lrs [Variables] special=Example Using the template below on the left creating a new project with project name 'my_new_proj' in directory 'My New Project', you get the instance on the right: Template dir Transformation Instantiated dir ------------ -------------- ---------------- project.ini not copied project.lpi substituted my_new_proj.lpi project.lpr substituted my_new_proj.lpr main.pas substituted main.pas main.dfm substituted main.dfm main.lrs copied as is main.lrs aux.pas substituted aux.pas where 'substituted' means that in the contents of the file, the following substitutions are carried through while copying: $(ProjName) -> my_new_proj $(ProjDir) -> My New Project $(special) -> Example In the README for components/projecttemplates is says: During the copy, the package will scan the file/directory names and the contents of the files for variable substitution: $(VARNAME) will be replaced by the value of a variable $(VARNAME). This suggests that substitutions are also done for file names (as well as the file contents). But how should one name the files, to get their names substituted? Should they rather be called $(ProjName).lpi $(ProjName).lpr This is rather awkward for a file name. Please confirm.

I admit it is rather awkward, but it is currently so :-)

Maybe we should introduce a variable 'ProjectFileName' in project.ini, which tells the templating engine which file is the project file. While copying files, it checks for variations of this filename (stripping extension), and if it matches, the ProjName is substituted.

What do you think ? It should be very easy to add; 15 minutes tops.

Michael.

Reply by email

Tom Verhoeff
to Michael Van Canneyt
Michael Van Canneyt wrote 62 lines
> > > > No. Any substitution must be marked as such. There are no 'special' > > cases, but if you want to send some patches to handle this, let me know. > > What you mention concerns substitutions _inside_ the (text) files. What I > was aiming at is substitutions of the _names_ of files being copied. > Assuming we have in project.ini: > > [Project] > Name=Special > Author=Tom > Description=A special FreePascal program. > Recurse=0 > Exclude=.lrs > > [Variables] > special=Example > > Using the template below on the left creating a new project with > project name 'my_new_proj' in directory 'My New Project', you get > the instance on the right: > > Template dir Transformation Instantiated dir > ------------ -------------- ---------------- > project.ini not copied > project.lpi substituted my_new_proj.lpi > project.lpr substituted my_new_proj.lpr > main.pas substituted main.pas > main.dfm substituted main.dfm > main.lrs copied as is main.lrs > aux.pas substituted aux.pas > > where 'substituted' means that in the contents of the file, > the following substitutions are carried through while copying: > > $(ProjName) -> my_new_proj > $(ProjDir) -> My New Project > $(special) -> Example > > In the README for components/projecttemplates is says: > > During the copy, the package will scan the file/directory names and the > contents of the files for variable substitution: $(VARNAME) will be > replaced by the value of a variable $(VARNAME). > > This suggests that substitutions are also done for file names (as > well as the file contents). But how should one name the files, > to get their names substituted? Should they rather be called > > $(ProjName).lpi > $(ProjName).lpr > > This is rather awkward for a file name. Please confirm. I admit it is rather awkward, but it is currently so :-) Maybe we should introduce a variable 'ProjectFileName' in project.ini, which tells the templating engine which file is the project file. While copying files, it checks for variations of this filename (stripping extension), and if it matches, the ProjName is substituted. What do you think ? It should be very easy to add; 15 minutes tops.

I think that foremost it should be clear to the user what the rules of the game are. I begin to understand it. Thanks.

The way it is now is quite flexible, but a bit awkward when it comes to file name substitution. For file names, the most important case is the name of the main program (.lpi, .lpr).

Since project.ini seems to be treated specially anyway (it is not copied), it makes sense to treat project.* also specially and substitute $(ProjName) for 'project'. I will then add an example...

(I'll start a new thread on renaming files within a project, after creation.)

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

Reply by email

Michael Van Canneyt
to Tom Verhoeff
Tom Verhoeff wrote 7 lines
Since project.ini seems to be treated specially anyway (it is not copied), it makes sense to treat project.* also specially and substitute $(ProjName) for 'project'. I will then add an example... (I'll start a new thread on renaming files within a project, after creation.)

I have implemented the option as I proposed it.
ProjectFile=demo
all files called demo.* will be renamed to the PROJNAME variable. (references to such file are NOT automatically renamed, you must replace these references with __PROJNAME__ yourself.

The ProjectFile setting defaults to 'project'.

Please take into account that the variable substitution happens on __VARNAME__ instead of $(VarName). This was a patch by someone, I don't remember who exactly. (there are 2 variable names which control this, so it's easily changeable).
I have adapted the README for this.

I adapted the variable dialog so that if no variables are present, the grid is disabled and the caption adapted accordingly.

Committed in revision 16196 of lazarus.

Michael.

Reply by email