Class with widgets lazarus / 31-LCL ---------------------------------------------------------------------- rise_nak · 2011-06-26 12:38 Hello! I'm trying to write a unit with some classes which I'm going to use in my panel called TitleTanel3. This classes includes GroupBoxes with some controls. I have the following code: Code: [Select]unit PanelGadgets; {$mode objfpc} interface uses   Classes, SysUtils, Forms, StdCtrls; type   TTabeleCheckGroup = class(TForm)     GroupBoxTabTyp: TGroupBox;     CheckBoxA: TCheckBox;     CheckBoxB: TCheckBox;     CheckBoxC: TCheckBox;   private     { private declarations }   public     { public declarations }     constructor Create;   end; implementation constructor TTabeleCheckGroup.Create; begin   inherited Create(Self);   GroupBoxTabTyp := TGroupBox.Create(Self);   CheckBoxA := TCheckBox.Create(Self);   CheckBoxB := TCheckBox.Create(Self);   CheckBoxC := TCheckBox.Create(Self); end; end.                      In this unit I want to put this groupboxes, next I create a class in main code: Code: [Select]procedure TMainForm.MenuItem15Click(Sender: TObject);     // for test code is in menu... begin   TabTypDzien := TTabeleCheckGroup.Create();                        // TabTypDzien is declared in TMainForm class   TabTypDzien.GroupBoxTabTyp.Parent := TitlePanel3; end; And I'm getting SIGSEGV, debugger points to function TControl.Notification and i don't know wthat is wrong.. ---------------------------------------------------------------------- marcov · 2011-06-26 12:53 Set the parent property of the manually created controls to their parent. (whatever control they are painted on top of) ---------------------------------------------------------------------- rise_nak · 2011-06-26 13:08 Thanks for reply. I modified constructor TTabeleCheckGroup.Create Code: [Select]constructor TTabeleCheckGroup.Create(aParent: TWinControl); begin   inherited Create(Self);   GroupBoxTabTyp := TGroupBox.Create(Self);   CheckBoxA := TCheckBox.Create(Self);   CheckBoxB := TCheckBox.Create(Self);   CheckBoxC := TCheckBox.Create(Self);   GroupBoxTabTyp.Parent := aParent;   CheckBoxA.Parent := GroupBoxTabTyp;   CheckBoxB.Parent := GroupBoxTabTyp;   CheckBoxC.Parent := GroupBoxTabTyp; end;              and in menu now is only: Code: [Select]TabTypDzien := TTabeleCheckGroup.Create(TitlePanel3); I didn't know what value set to parent property in GroupBoxTabTyp, so I made a param aParent, is it ok? Still is SIGSEGV and debugger shows the same... ---------------------------------------------------------------------- Leledumbo · 2011-06-26 15:11 QuoteAnd I'm getting SIGSEGV, debugger points to function TControl.Notification and i don't know wthat is wrong..Open the call stack window, get the first entry pointing to your source code. Code: [Select]inherited Create(Self);Wait, wait, you're setting Owner of a form to itself?