[Solved] Creating a class lazarus / 31-LCL ---------------------------------------------------------------------- iru · 2019-01-23 06:17 Gentlefolk, I have problem with the understanding/use of classes, specifically the operation of a create. From reading and examples the following should create a 'class' based on tObject. Compiles clean but when executed   MB = NIL. and therefore one gets a SigSev when trying to access ThePanel...... Any explanations and/or examples of correct usage appreciated, Ian. type   tMyBut = class     ThePanel : tPanel;   public      constructor Create;   end; var   MB : tMyBut; implementation constructor tMyBut.Create; Begin   Inherited Create; end; ---------------------------------------------------------------------- Handoko · 2019-01-23 06:42 It should be something 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 type   { tMyBut }  tMyBut = class    ThePanel : TPanel;  public     constructor Create;     destructor Destroy; override;  end; implementation { tMyBut } constructor tMyBut.Create;begin  inherited Create;  ThePanel := TPanel.Create(nil);end; destructor tMyBut.Destroy;begin  ThePanel.Free;  inherited Destroy;end; When use it on a form, don't forget to free it: 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 var  Form1 : TForm1;  MB    : tMyBut; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin  MB := tMyBut.Create;end; procedure TForm1.FormDestroy(Sender: TObject);begin  MB.Free;end; ---------------------------------------------------------------------- iru · 2019-01-23 23:34 Thank you for the response. and the example code. So , not much different to what I was doing but it works! I must be getting old..... Thanks again, Ian