[Lazarus] Doing work in FormActivate

Gabor Boros gaborboros at yahoo.com
Tue Jan 13 17:54:56 CET 2009


My main problem is the form not appears on the screen under OnActivate 
event. How can I make a progress form, display some informations, 
progress bars etc. and when the job finished the user can read the 
information and then close the form with a button?

Doug Chamberlin írta:
> For Windows the OnActivate event should fire every time the window is 
> re-activated as you describe. This is as designed. If you want to 
> process something only once when the window is first activated try the 
> OnShow event.
> 
> If you must run some code only once but still within the OnActivate 
> handler, the best way I have found is to add a field to the TForm that 
> indicates the OnActivate has been run once. I usually use FActivated: 
> Boolean for this. Then in the OnActivate handler put:
> 
> if not FActivated then begin
>    //Do some work here that should only happen once
>    FActivated := True;
>    end;




More information about the Lazarus mailing list