Is there a util to make a new class skeleton? lazarus / 61-Beginners ---------------------------------------------------------------------- bulrush · 2016-06-29 11:42 20 years ago I made a utility to create a new class skeleton for Delphi 7. The user would enter the property names and variable types for each property, then the util would make all the code skeletons and definitions that were needed in a .pas file, as I noticed there was a lot of repetition when making a class. Alas, my 3.5" floppy disks are gone. Is there such a util today? ---------------------------------------------------------------------- Graeme · 2016-06-29 12:40 I have seen some such utilities, and even wrote one myself. But I haven't used them in years. These days all IDE's (and text editors) support Code Templates and Code Completion which can generate most of the boilerplate code for you. In Lazarus IDE, Code Templates are trigger with Ctrl+J.  Code or Class Completion is trigger with Ctrl+Shift+C. ---------------------------------------------------------------------- Leledumbo · 2016-06-29 13:03 CodeTools should be better than a skeleton, its code completion is one of the most advanced feature an IDE can have. ---------------------------------------------------------------------- bulrush · 2016-06-29 15:58 I guess what I mean was, if I want to create a new class with 50 properties, will code completion, or another util, create all the internal F variables, all the Get routines, and any required routines to make a complete, functional class in one pass? ---------------------------------------------------------------------- Graeme · 2016-06-29 21:02 Quote from: bulrush on June 29, 2016, 05:58:56 pmI guess what I mean was, if I want to create a new class with 50 properties, will code completion, or another util, create all the internal F variables, all the Get routines, and any required routines to make a complete, functional class in one pass? Yes, that is exactly what it does. eg: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    TPerson = class(TObject)   end; That can be done with an parameterised Code Template, so all you would really need to type is "Person". ... then ... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    TPerson = class(TObject)   published      property FirstName: string read GetFirstName write SetFirstname;   end;  Then by typing the highlighted line and invoking Class Completion, the IDE would create a private FFirstName: string field variable. It will also define and implement the GetFirstName() and SetFirstName() methods. ---------------------------------------------------------------------- Leledumbo · 2016-06-30 06:03 Quote from: Graeme on June 29, 2016, 11:02:19 pmThen by typing the highlighted line and invoking Class Completion, the IDE would create a private FFirstName: string field variable. It will also define and implement the GetFirstName() and SetFirstName() methods. It works even without reader and writer specified, i.e.: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i property FirstName: String;alone should be enough. It however assumes that you want the property to be always read-write though, if you want it to be read only / write only, you have to explicitly specify it. ---------------------------------------------------------------------- bulrush · 2016-06-30 13:47 Thanks all. If I wanted to store my new class in a .pas file is it stored in a unit file like this? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Unit myclass      TSum = class(TObject)private// ...end; //TSum class end. //Unit ---------------------------------------------------------------------- howardpc · 2016-06-30 14:38 Not really. About the minimum required for a new unit is something like the following: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit myclass; {$mode objfpc}{$H+} // or other directives as required interface {uses  Classes, SysUtils; in this simple case no uses clause is required} type   TSum = class(TObject)  private    FInt1, FInt2: integer;    function GetSum: integer;  public    constructor Create(int1, int2: integer);    property Sum: integer read GetSum;  end; //TSum class implementation constructor TSum.Create(int1, int2: integer);begin  inherited Create; //optional in this case  FInt1:=int1;  FInt2:=int2;end; function TSum.GetSum: integer;begin  Exit(FInt1 + FInt2);end; end. //Unit