Here more reduced example.
OnTimer is triggered every 1 second.
The aim is to show incrementing Cnt to display its value.
It works fine until you need to use OnResize to do something canvas drawing with FormResize procedure.
Then the canvas remains blank.
As example there is the line
Canvas.Line(10, 10, 100, 100) in the FormResize procedure.
If it is commented out the counter begins to display again.
This problem appears with Lazarus in Raspberry Pi not in Windows.
In RPi it seems that if you use any canvas functions in FormResize it not only refuses to work but also prevent all other canvas drawings to display.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Graphics, ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Timer1: TTimer;
procedure FormResize(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
Cnt: Integer;
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Inc(Cnt);
Canvas.Brush.Color := clDefault;
Canvas.Font.Color := clBlack;
Canvas.FillRect(20, 20, 40, 40);
Canvas.TextOut(20, 20, IntToStr(Cnt));
end;
procedure TForm1.FormResize(Sender: TObject);
begin
Canvas.Pen.Color := clBlack;
Canvas.Line(10, 10, 100, 100);
end;
end.
Doesn't work: Raspberry Pi 3 Raspbian Jessie, Lazarus 1.7, FPC 3.1.1
Works: Windows 64, Lazarus 1.6.4, FPC 3.0.2