Is there a way to implement a bottom-up event notification in Firemonkey?

  

I have a container control (TLayout or TPanel or TScrollbox, etc.) which can have several other nested controls inside. Is there a way in Firemonkey to know when the container becomes “active”? I mean for example:

when any of its children get focus or
user clicks any of its non-focus controls

I am asking for a kind of event-bubble. OnClick would be enough so when user clicks any nested control, the parent container is notified. Control’s HitTest property would be a solution but if I set that property to False (to let the parent manages the onlick) on a TEdit, it becomes useless obviously (I can’t type on it)

Edit:

A simple layout example:

Drop a TScrollBox in a form
Drop a TPanel in form and put it as child of the TScrollBox
Drop a TEdit in form an put it as child of TPanel

Ok, I can simply do a sort of Parent.Parent.Click after receive the OnClick on TEdit but imagine now several TScrollBoxes, with different level of nesting using TPanels with a bunch of different controls inside. It doesn’t make sense neither adding the onclick code for each control in the tree, nor change the hierarchy of Parent.Parent.Click every time I redesign the layout adding an intermediate parent control.

Is there any way to do this in Firemonkey (either for Windows or MacOS)?

PS: I’m using Delphi 10.2.3 (Tokyo)

Comments are closed.