Now, any object can listen for an event named 'StyleFocused' on this window, and you can bind to it by attaching a delegate to it (!). So, the window's child components such as TQTXWindowElement, simply use the generic AddDelegate method to listen for that exact event name.


// Inside TQTXWindowElement.Create

var

 lForm: TQTXCustomForm;

begin

 ...

 // Bind to the custom event name published by the parent

 if FindFormForWidget(self, lForm) then

 begin

   lForm.AddDelegate(CNT_EVENT_FOCUSED, @HandleActiveEvent);

   lForm.AddDelegate(CNT_EVENT_UNFOCUSED, @HandleInActiveEvent);

 end;

 ...

end;


When TQTXWindow dispatches its 'StyleFocused' event, this delegate's HandleActiveEvent procedure is automatically called.