[fpc-pascal] Windows programming tutorials for FPC

Bo Berglund bo.berglund at gmail.com
Sun Nov 4 19:27:56 CET 2018

On Sun, 4 Nov 2018 11:29:23 -0500, "James"
<james at productionautomation.net> wrote:

>The Lazarus version is mostly working in Lazarus, but instead of everything 
>happening before the form is loaded, is there a way I could make the form 
>first, then just start processing everything, so that my messages I send to
> memo1 show up as it's processing?  I'm guessing I need to move my program 
>from On-create to somewhere else so it runs after the memo box is showing... 
>but I don't know where I would move it to.  
>Any suggestions?

In a Lazarus GUI program you can use a timer to handle this.
Just set it to say 1s delay and thenb enable it in Form.OnCreate:

TfrmMain = class(TForm)
 Timer1: TTimer;

procedure TfrmMain.FormCreate(Sender: TObject);
  Timer1.Interval := 500; //Default is 1000 ms
  Timer1.Enabled := true;

procedure TfrmMain.Timer1Timer(Sender: TObject);
  //Put your code here
  Application.Terminate; //The application will disappear from view...

If you want your form to be responsive you also need this inside loops
in your program:

Otherwise the form will feel like a dead brick while the Timer
function runs...

Bo Berglund
Developer in Sweden

More information about the fpc-pascal mailing list