Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Use the <a href="http://docwiki.embarcadero.com/VCL/en/Classes.TComponent.Notification" rel="nofollow noreferrer"><code>TComponent.Notification</code></a> method. It's called on all components with a common owner when any of them is inserted or removed from its owner. You can call also call <a href="http://docwiki.embarcadero.com/VCL/en/Classes.TComponent.FreeNotification" rel="nofollow noreferrer"><code>FreeNotification</code></a> to get notifications about components with <em>different</em> owners.</p> <p>For example, when the <code>PopupMenu</code> property is set on a button, the button calls the menu component's <code>FreeNotification</code> method. If the menu later gets deleted, it will call <code>Notification</code> on the button, and the button will clear its <code>PopupMenu</code> property since it no longer refers to a valid object.</p> <p>You can override <code>Notification</code> to monitor insertions and deletions. A harder task will be to monitor when a component <em>moves</em>, if that's something you need to know. Just because a component was your left neighbor when it was added doesn't mean it will remain your left neighbor forever. (In fact, position probably isn't valid at insertion time anyway.) At run time, controls' positions are probably not going to change, so if you have a way of detecting relative positions of controls, the <a href="http://docwiki.embarcadero.com/VCL/en/Classes.TComponent.Loaded" rel="nofollow noreferrer"><code>Loaded</code></a> method is a good place to do it. That method is called after the DFM has been read and all the components' properties have been set.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload