Recent

Author Topic: Where to place to run on start?  (Read 585 times)

coradi

  • Jr. Member
  • **
  • Posts: 53
Where to place to run on start?
« on: June 28, 2018, 11:49:50 am »
Hallo,
where I have to put this line
  Label1.Caption:='Test';

If I want to run it, at programmstart?
Without clicking a Button or other things

Code: [Select]
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Label1Click(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Label1Click(Sender: TObject);
begin

end;

procedure TForm1.Button1Click(Sender: TObject);
begin

end;

end. 
Amstrad Schneider CPC 6128
Wind XP / 7 / 10

Bart

  • Hero Member
  • *****
  • Posts: 3308
    • Bart en Mariska's Webstek
Re: Where to place to run on start?
« Reply #1 on: June 28, 2018, 12:07:19 pm »
Set the caption in the ObjectInspetor.
Alternatively use OnCreate event of Form1 and set Caption there.

Bart