[SOLVED] MessageBox obscures window. lazarus / 31-LCL ---------------------------------------------------------------------- Hopestation · 2015-02-17 12:28 Hi. I am using Version #: 1.2.6, FPC Version 2.6.4, SVN Revision 46259 on Windows XP, SP3. I have included a Message box on a form, in the OnShow procedure. When I run the program the message box appears, but nothing else. When I close the Message box the form appears. I have tried  adding a number of Application.Processmessages calls before calling the message box, but this makes no difference. Setting Optimisation to 0 makes no difference. This my Code: var    Form1: TForm1;    PosX, PosY: Integer; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormShow(Sender: TObject); begin     Left:= 0;    Top := 0;    Application.ProcessMessages;    Width := Screen.Width;    Height := Screen.Height;    Application.ProcessMessages;    PosX := (ClientWidth - 200) Div 2;     // Left side of Message Box    PosY := 2 * (ClientHeight - 10) Div 3; // Top of Message Box    Application.ProcessMessages;    ShowMessagePos('Test Instrument(s) not connected', PosX, PosY); end; Is there a way to prevent this? Thanks ---------------------------------------------------------------------- howardpc · 2015-02-17 12:35 Use the form's OnActivate event (not OnShow). Also you don't need the calls to Application.ProcessMessages. ---------------------------------------------------------------------- Hopestation · 2015-02-17 12:49 Amazing!! I can't believe it's so simple. I have never used this event before. Thanks for your help.