Recent

Author Topic: Are component templates available for Lazarus?  (Read 5786 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Are component templates available for Lazarus?
« on: July 17, 2014, 12:52:33 pm »
Delphi has a feature called component templates that enables you to layout and group a set of UI components grouped and laid out in a desired manner. You can the add the group to the component palette just as with a frame, and pick and place it when you need it.

Does Lazarus have this facility? I think I have seen it before but I am not sure.
Lazarus 3.0/FPC 3.2.2

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Are component templates available for Lazarus?
« Reply #1 on: July 18, 2014, 07:02:22 pm »
Delphi has a feature called component templates that enables you to layout and group a set of UI components grouped and laid out in a desired manner. You can the add the group to the component palette just as with a frame, and pick and place it when you need it.

Does Lazarus have this facility? I think I have seen it before but I am not sure.

No reply in over 24 hrs.

Is that a no?
Lazarus 3.0/FPC 3.2.2

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Are component templates available for Lazarus?
« Reply #2 on: July 18, 2014, 07:15:31 pm »
I do not know anything about component templates when were they introduced and what is the difference with the lcl frames (other than the various bugs that is)?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Are component templates available for Lazarus?
« Reply #3 on: July 18, 2014, 07:35:26 pm »
I do not know anything about component templates when were they introduced and what is the difference with the lcl frames (other than the various bugs that is)?

There is a good example here

http://delphi.wikia.com/wiki/Creating_Component_Templates

There is also this interesting code-oriented alternative from Stack Overflow, which isn't a graphic component, but might apply better to Lazarus

http://stackoverflow.com/questions/11243208/delphi-creating-component-template
Lazarus 3.0/FPC 3.2.2

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Are component templates available for Lazarus?
« Reply #4 on: July 18, 2014, 08:13:48 pm »
no nothing like exists as far as I know.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Lazarus 3.0/FPC 3.2.2

FTurtle

  • Sr. Member
  • ****
  • Posts: 292
Re: Are component templates available for Lazarus?
« Reply #6 on: February 25, 2016, 02:43:54 am »
Still/not yet available in Lazarus?

http://docwiki.embarcadero.com/RADStudio/Seattle/en/Creating_and_Using_Component_Templates

You can use it in Lazarus right now.
The only shortcoming is you can not include pre-configured components in palette.

Steps for creating:

1. Create new form.
2. Name it  _Templates_Form
3. Save as  _templates.pas
4. Be sure that form is not autocreated
5. Put buttoin on the form
6. Set properties (Anchors, Caption, ModalResult, etc.)
7. Save

Usage:

1. Open _Templates_Form
2. Select your button (dialog, etc)
3. Right click / Copy
4. Go to form that you develop
5. Right click / Paste

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Are component templates available for Lazarus?
« Reply #7 on: February 25, 2016, 10:51:41 am »
Does this mean that all the component templates must be placed in only that form, ie does the form have to be named _Templates_Form and the file named _templates.pas, or can you have different _templates1.pas, _templates2.pas etc, with the proviso that the form is named _Templates_Form?

Which versions of Lazarus have this feature?

Still/not yet available in Lazarus?

http://docwiki.embarcadero.com/RADStudio/Seattle/en/Creating_and_Using_Component_Templates

You can use it in Lazarus right now.
The only shortcoming is you can not include pre-configured components in palette.

Steps for creating:

1. Create new form.
2. Name it  _Templates_Form
3. Save as  _templates.pas
4. Be sure that form is not autocreated
5. Put buttoin on the form
6. Set properties (Anchors, Caption, ModalResult, etc.)
7. Save

Usage:

1. Open _Templates_Form
2. Select your button (dialog, etc)
3. Right click / Copy
4. Go to form that you develop
5. Right click / Paste
« Last Edit: February 25, 2016, 10:53:15 am by vfclists »
Lazarus 3.0/FPC 3.2.2

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Are component templates available for Lazarus?
« Reply #8 on: February 25, 2016, 11:02:56 am »
I do not know anything about component templates when were they introduced
They've been in Delphi since D5 or D6 if I remember correctly.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Are component templates available for Lazarus?
« Reply #9 on: February 25, 2016, 11:19:38 am »
You can do similar things using frames and form inheritance.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Are component templates available for Lazarus?
« Reply #10 on: February 25, 2016, 12:49:32 pm »
You can do similar things using frames and form inheritance.

I use frames and embedded forms, but they seem overkill for simple controls.
Lazarus 3.0/FPC 3.2.2

FTurtle

  • Sr. Member
  • ****
  • Posts: 292
Re: Are component templates available for Lazarus?
« Reply #11 on: February 25, 2016, 04:33:41 pm »
Does this mean that all the component templates must be placed in only that form, ie does the form have to be named _Templates_Form and the file named _templates.pas, or can you have different _templates1.pas, _templates2.pas etc, with the proviso that the form is named _Templates_Form?

Which versions of Lazarus have this feature?

I mean that you can achieve the results that provide component templates without  component templates, using the existing features of IDE, but a little less convenient.
You can simply copy any component from any form to another form with current (changed) properties. This works in all versions of Delphi and Lazarus.
But in working form usually assigned event handlers and etc which you dont need.
Therefore, I propose to use a separate form for pre-configured components. This form (or forms) will only serve as a container for pre-configured components, something like analog of palette. Name of the form and the number of forms may be arbitrary. After finishing of developing you may exclude that form from project.
« Last Edit: February 25, 2016, 04:37:32 pm by FTurtle »

 

TinyPortal © 2005-2018