[Lazarus] New Form default properties

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] New Form default properties

Alexsander Rosa
Is there a place to define the "default" values for some Form properties when a "New Form" is created by IDE?
I know I could use inheritance, but it seems a little overkill when all I want is to define width and height properties.

--
Atenciosamente,
Alexsander da Rosa
http://rednaxel.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] New Form default properties

Mattias Gaertner
On Fri, 11 Feb 2011 12:17:54 -0200
Alexsander Rosa <[hidden email]> wrote:

> Is there a place to define the "default" values for some Form properties
> when a "New Form" is created by IDE?
> I know I could use inheritance, but it seems a little overkill when all I
> want is to define width and height properties.

You can define your own forms, use the project templates, use the
inherited form or patch the IDE.
There is no "All I want to" thing.
Defining some default values for component classes is a nice feature,
but if you ask ten developers you get ten different ideas how to do
that. That's why such a feature is better provided by a package.


Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] New Form default properties

Alexsander Rosa
And what about the file $HOME/.lazarus/environmentoptions.xml ?
According to unit EnvironmentOpts it can hold a "newformtemplate".
Is this a not-yet-implemented feature? If it is, how could I help finish it?

procedure TMainIDE.mnuNewFormClicked(Sender: TObject);
var
  Category: TNewIDEItemCategory;
  Template: TNewIDEItemTemplate;
  Desc: TProjectFileDescriptor;
  Flags: TNewFlags;
begin
  Category:=NewIDEItems.FindByName(FileDescGroupName);
  Template:=Category.FindTemplateByName(EnvironmentOptions.NewFormTemplate);
  if (Template is TNewItemProjectFile) and Template.VisibleInNewDialog then
    Desc:=TNewItemProjectFile(Template).Descriptor
  else
    Desc:=FileDescriptorForm;
  Flags:=[nfOpenInEditor,nfCreateDefaultSrc];
  if (not Project1.IsVirtual) and EnvironmentOptions.AskForFilenameOnNewFile then
    Flags:=Flags+[nfAskForFilename,nfSave];
  Desc.Owner:=Project1;
  try
    DoNewEditorFile(Desc,'','',Flags);
  finally
    Desc.Owner:=nil;
  end;
end;               

My .lazarus xml file does not have these tags.

2011/2/11 Mattias Gaertner <[hidden email]>
On Fri, 11 Feb 2011 12:17:54 -0200
Alexsander Rosa <[hidden email]> wrote:

> Is there a place to define the "default" values for some Form properties
> when a "New Form" is created by IDE?
> I know I could use inheritance, but it seems a little overkill when all I
> want is to define width and height properties.

You can define your own forms, use the project templates, use the
inherited form or patch the IDE.
There is no "All I want to" thing.
Defining some default values for component classes is a nice feature,
but if you ask ten developers you get ten different ideas how to do
that. That's why such a feature is better provided by a package.


Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
Atenciosamente,
Alexsander da Rosa
http://rednaxel.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] New Form default properties

Mattias Gaertner
On Fri, 11 Feb 2011 13:52:21 -0200
Alexsander Rosa <[hidden email]> wrote:

> And what about the file *$HOME/.lazarus/environmentoptions.xml* ?
> According to unit *EnvironmentOpts* it can hold a "newformtemplate".

This variable defines what item to create when clicking on the
speedbutton "New form".


> Is this a not-yet-implemented feature?

As I wrote: Every programmer has his own idea how a form template
should work. So, yes, it is a not implemented feature.


> If it is, how could I help finish it?

Create a design time package and register your template. And if you
think others might find it useful publish it, for example on
lazarus-ccr. If other people find it useful and you can convince us
that the package is maintained, it may be added to the Lazarus sources.

 
Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus