When a TQTXWindow is focused, it doesn't call its children directly. Instead, it creates an instance of a custom event object and "dispatches" it on itself.


// Inside TQTXWindow.StyleAsActive


const CNT_EVENT_FOCUSED = 'StyleFocused';


// Create an event object with that name

var lEvent := TQTXWindowFocusedEvent.Create(CNT_EVENT_FOCUSED, [eoBubbles]);

try

 // Fire the event on the window's own event target!

 lEvent.Dispatch( self.EventTarget );

finally

 lEvent.Free;

end;