Images in Lazarus

After I found the TImage object in the Additional tab, I Assumed this would be easy. But I had to google. The last comment below was how tried to do it at 1st…Lazarus, didn’t like. It’s been awhile. I guess I’m not thinking in Lazarus/Pascal. Anyway the below code works.

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Image1Click(Sender: TObject);
  private
    var pic: TPicture;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
     pic:=TPicture.Create;
     pic.LoadFromFile('PDP-11_1200x600.jpg');
     image1.Picture:=pic;
//   image1.Picture:='PDP-11_1200x600.jpg';
end;


Also, at one point in my testing, I wanted to remove a picture, I had loaded at design time. But as you can see below “Clear” is grayed out. Somewhere along the line I looked at it again, and it wasn’t grayed, and I could “Clear” it.