Hi, I know this is silly, but I want to create a window strictly from code (so without any resource file). Yes I am an old school kind of guy.
I used the code below. It runs fine but it only shows the form with no border nor buttons (I am on Mac OSX).
First of all, am I doing this correctly, I mean regarding the resource-less aspect of it ?
Secondly, what is missing in order to get the full window with border & buttons ?
Thanks in advance!
program helloworld;
{$mode objfpc} {$H+}
uses Classes, Interfaces, Forms, StdCtrls, Controls;
type
TForm1 = class(TForm)
Button1: TButton;
end;
var
Form1: TForm1;
begin
Application.Initialize;
Form1 := TForm1.CreateNew(nil);
Form1.Button1 := TButton.Create(Form1);
With Form1.Button1 Do
begin
Parent := Form1;
Visible := TRUE;
Left := 10;
Top := 10;
Width := 100;
Height := 100;
Caption := 'PRESS ME';
end;
Form1.BorderStyle:= Controls.bsSizeable;
Form1.show();
Application.Run;
end.