Delphi 11 FormCreate not called

167 views Asked by At

I have a TRemote class derived from TForm.

I want to setup some buttons callback, and place a specific Button+Path on the screen during the Form's OnCreate event.

But nothing happens!

When I place a breakpoint, it is never reached.

Can someone explain to me why?

procedure TRemote.FormCreate(Sender: TObject);
var
  I: Integer;
  ButtonPath1: TButtonPath;
begin
  ButtonPath1 := TButtonPath.Create(Self);
  ButtonPath1.Parent := Self;
  ButtonPath1.SetBounds(50, 50, ButtonPath1.Width, ButtonPath1.Height); // set the position of ButtonPath


  // Loop through components
  for I := 0 to ComponentCount - 1 do
  begin
    // Check if it is a button ?
    if Components[I] is TButton then
    begin
      // Attach HandleButtonClick to OnClick event of this button
      TButton(Components[I]).OnClick := HandleButtonClick;
    end;
  end;
end;
0

There are 0 answers