« on: June 14, 2026, 08:59:43 pm »
UPDATE... Deactivate doesn't work like I thought that it did...SORRY!!!
Win11, Lazarus 4.8, Error happens when running the .exe both inside and external to the IDE
----------------
The following code only ever shows "Activate" when program is initially started.
"Deactivate" NEVER fires and "Activate" NEVER fires again after initial startup
despite the fact that I start a text editor then switch back to the program
==================
LFM is:
object Form1: TForm1
Left = 477
Height = 240
Top = 164
Width = 320
Caption = '0'
DesignTimePPI = 120
LCLVersion = '4.8.0.0'
OnActivate = FormActivate
OnDeactivate = FormDeactivate
end
=================
So Events are assigned normally
WHAT AM I MISSING???
unit Unit1;{$mode objfpc}{$H+}
interface
uses Classes, StdCtrls, SysUtils, Forms, Controls, Graphics, Dialogs;
type { TForm1 }
TForm1 = class(TForm)
procedure FormActivate(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
end;
var
Form1: TForm1;
implementation{$R *.lfm}{ TForm1 }
// OnActivate = FormActivate in Object Inspector
// On Deactivate = FormDeactivate in Object Inspector
procedure TForm1.FormActivate(Sender: TObject);
begin
ShowMessage('Activate');
end;
procedure TForm1.FormDeactivate(Sender: TObject);
begin
ShowMessage('Deactivate');
end;
end.
« Last Edit: June 14, 2026, 09:05:50 pm by Ten_Mile_Hike »

Logged
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.
Robert A. Heinlein