[lazarus] Edit1.Text:=Label1.Caption ??

NORBERT ALLAIN NORBERT.ALLAIN at WANADOO.FR
Sun Jun 24 17:25:07 EDT 2001


My code compile but i have a semgmentation fault.
Why ?

unit unit1;

{$mode objfpc}
{$H+}

interface
uses classes, forms, stdctrls, buttons;

type
   TForm1 = class(TForm)
      private
      protected
      public
         
         
         Label_Message: TLabel;	
         Edit_User: TEdit;	
         ButtonOk:TButton;
         ButtonQuitter: Tbutton;
         constructor Create(AOwner:TComponent);override;
         procedure ButtonOkClick(Sender: TObject);
         procedure ButtonQuitterClick(Sender : TObject);
         procedure FormDestroy(Sender : TObject);
    end;


var Form1: TForm1;

implementation


constructor TForm1.Create(AOwner:TComponent);
begin
   inherited Create(AOwner);
   Caption:='Test';
   Width:=400;
   Height:=200;
   Left:=200;
   Top:=200;

   Edit_User:=TEdit.Create(self);
   Edit_User.Parent:=self;
   Edit_User.Left:=150;
   Edit_User.Top:=35;
   Edit_User.Width:=150;
   Edit_User.Height:=20;
   Edit_User.Caption:='';
   Edit_User.show;

   Label_Message:=TLabel.Create(self);
   Label_Message.Parent:=self;
   Label_Message.Left:=50;
   Label_Message.Top:=100;
   Label_Message.Width:=300;
   Label_Message.Height:=35;
   Label_Message.Caption:='Message:';
   Label_Message.show;


   ButtonOk:=TButton.Create(self);
   ButtonOk.OnClick:=@ButtonOkClick;
   ButtonOk.Parent:=self;
   ButtonOk.Left:=75;
   ButtonOk.Top:=150;
   ButtonOk.Width:=75;
   ButtonOk.Height:=35;
   ButtonOk.Caption:='Ok';
   ButtonOk.show;
   
   ButtonQuitter:=TButton.Create(self);
   ButtonQuitter.OnClick:=@ButtonQuitterClick;
   ButtonQuitter.Parent:=self;
   ButtonQuitter.Left:=250;
   ButtonQuitter.Top:=150;
   ButtonQuitter.Width:=75;
   ButtonQuitter.Height:=35;
   ButtonQuitter.Caption:='Quitter';
   ButtonQuitter.show;
end;
      
{********************************************************************
*}
procedure TForm1.ButtonQuitterClick(Sender : TObject);
begin
   Close;
end; { ButtonQuitterClick }

{********************************************************************
*}
procedure TForm1.FormDestroy(Sender : TObject);
begin
end; { FormDestroy }

{********************************************************************
*}
procedure TForm1.ButtonOkClick(Sender : TObject);

begin 
Label_Message.Caption:= Edit_User.text;
end;	       

{********************************************************************
*}
end.








More information about the Lazarus mailing list