Sign in Join

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

Mailing lists / lazarus / 2010-11

New unit with resource with some components on it by default

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Joost van der Sluis

Hi all,

Is it possible to add a 'new module' option to the ide which has by default some components on it?

With a TFileDescPascalUnitWithResource, it is possible to add a new module type, but I can't find out a way to add some components on it by default. (I could add the definitions to the code, offcourse, but how to add them to the resource?)

Or do we have to add something for this so that it becomes possible?

Joost.

Reply by email

Mattias Gaertner
to Joost van der Sluis
Show quoted text 9 lines
Hi all, Is it possible to add a 'new module' option to the ide which has by default some components on it? With a TFileDescPascalUnitWithResource, it is possible to add a new module type, but I can't find out a way to add some components on it by default. (I could add the definitions to the code, offcourse, but how to add them to the resource?)

You can specify the lfm. Override the method GetResourceSource.

Or do we have to add something for this so that it becomes possible?

Mattias

Reply by email

Joost van der Sluis
to Mattias Gaertner
Mattias Gaertner wrote 14 lines
On Mon, 29 Nov 2010 10:21:07 +0100 Joost van der Sluis wrote: > Hi all, > > Is it possible to add a 'new module' option to the ide which has by > default some components on it? > > With a TFileDescPascalUnitWithResource, it is possible to add a new > module type, but I can't find out a way to add some components on it by > default. (I could add the definitions to the code, offcourse, but how to > add them to the resource?) You can specify the lfm. Override the method GetResourceSource.

Thanks. It has a bug, though. If I use it to generate something else then a form, using a designer. It still handles the component/resource as if it was a form.

That's because CreateRawComponentFromStream is called for the just generated resource. Which assumes a form. CreateNewForm, on the other hand, handles the non-lcl-component right. (CreateNewForm is used when there's no resource-content given)

Shall I create a bug-report?

Joost.

Reply by email

Mattias Gaertner
to Joost van der Sluis
Show quoted text 26 lines
On Mon, 2010-11-29 at 10:34 +0100, Mattias Gaertner wrote: > On Mon, 29 Nov 2010 10:21:07 +0100 > Joost van der Sluis wrote: > > > Hi all, > > > > Is it possible to add a 'new module' option to the ide which has by > > default some components on it? > > > > With a TFileDescPascalUnitWithResource, it is possible to add a new > > module type, but I can't find out a way to add some components on it by > > default. (I could add the definitions to the code, offcourse, but how to > > add them to the resource?) > > You can specify the lfm. Override the method GetResourceSource. Thanks. It has a bug, though. If I use it to generate something else then a form, using a designer. It still handles the component/resource as if it was a form. That's because CreateRawComponentFromStream is called for the just generated resource. Which assumes a form. CreateNewForm, on the other hand, handles the non-lcl-component right. (CreateNewForm is used when there's no resource-content given) Shall I create a bug-report?

Yes, I need an example for testing.

Mattias

Reply by email

Joost van der Sluis
to Mattias Gaertner
Mattias Gaertner wrote 31 lines
On Tue, 30 Nov 2010 13:15:19 +0100 Joost van der Sluis wrote: > On Mon, 2010-11-29 at 10:34 +0100, Mattias Gaertner wrote: > > On Mon, 29 Nov 2010 10:21:07 +0100 > > Joost van der Sluis wrote: > > > > > Hi all, > > > > > > Is it possible to add a 'new module' option to the ide which has by > > > default some components on it? > > > > > > With a TFileDescPascalUnitWithResource, it is possible to add a new > > > module type, but I can't find out a way to add some components on it by > > > default. (I could add the definitions to the code, offcourse, but how to > > > add them to the resource?) > > > > You can specify the lfm. Override the method GetResourceSource. > > Thanks. It has a bug, though. If I use it to generate something else > then a form, using a designer. It still handles the component/resource > as if it was a form. > > That's because CreateRawComponentFromStream is called for the just > generated resource. Which assumes a form. CreateNewForm, on the other > hand, handles the non-lcl-component right. (CreateNewForm is used when > there's no resource-content given) > > Shall I create a bug-report? Yes, I need an example for testing.

Done. I didn't add a real example, but the real case I'm having problems with with webdesign. So you have to use fppkg to install the 'example'.

http://bugs.freepascal.org/view.php?id=18116

Joost.

Reply by email