|
1. onactivate is an activation event, which is triggered when the window gets the focus (that is, the title bar becomes blue) and becomes the current state. This event mainly executes DoNestedActivation
procedure DoNestedActivation (Msg: Cardinal; Control: TWinControl; Form: TCustomForm);
begin
if Control = nil then Exit;
{Find the closest parent which is a form}
while (Control.Parent <> nil) and not (Control is TCustomForm) do
Control: = Control.Parent;
if Assigned (Control) and (Control <> Form) then
SendMessage (Control.Handle, Msg, 0, 0)
end;
On the contrary, it is the ondeactivate event, which is the loss of focus and the transition from the current state to the inactive state
When executing these events, the OnCreate event has already been executed. The onCreate event is an initialization event, also called a create event. Is the constructor
2. The onclose event is an event to be executed before the window is closed. The hide form will not execute this event.
The FormCloseQuery event is more interesting. It is also an event to be executed before closing the window. It is executed before the onclose event. There is a parameter Canclose in this event to restrict you from closing the window. CanClose: = False; indicates that it cannot be closed, on the contrary CanClose: = true allows closing
Corresponding to the oncreate constructor event is the ondestroy destroy function event, which is only the event executed before releasing all window resources at the end of the window |
|