Forum > LCL

Form OnActivate event does not fire when a form is maximized.

(1/2) > >>

mm7:
Hi.

is it new behaviour? Not documented though.

I see following code in customform.inc

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TCustomForm.Activate;begin  if FIsFirstOnActivate and (WindowState in [wsMaximized, wsFullScreen]) then    Exit;  FIsFirstOnActivate := False;  if Assigned(FOnActivate) then FOnActivate(Self);end; 
But why this condition is there? What is a purpose?

jamie:
if a form is already at full screen, then I guess it's already active.

mm7:
How it can be active it is just created and just got focus?
Why to skip the event?
Also FIsFirstOnActivate will not be set to False;
and next time it may fire the OnActivate when the window is not maximized.

And it is not documented that OnActivate does not fire on a window that is created maximized.

Should I re-think my app, or is it a bug in LCL and it will be fixed?

jamie:
Most likely someone had a loop bug?

Lots of people misuse events.

If you need that trigger, you can implement the LM_ACTIVATE message handler in your form and capture it before the form gets control of it.
 

mm7:
For the time being I assigned the same handler on Application.onActivate.
I already have reentrance detection in my handler.

Navigation

[0] Message Index

[#] Next page

Go to full version