I have a form with a panel.
I create frames at runtime and display them on the panel by setting frame's parent property to the panel.
When creating panels I do not set the owner property because i manage myself the lifetime of the frame.
Until now i got no problem. Next I put an TActionList on the frame with some shortcuts on the actions.
I found that my actions did not execute until I set the owner property of the frame to the panel.
Can someone can explain me that ? I thought that owner property was just about wich component is responsible to free the children components, and not responsible to forward key events.
The shortcut handling of the form is done in TCustomForm.IsShortCut
, where the components are iterated which includes TActionLists. While the frame is not owned by the form, none of the actionlists on the frame are found during the iteration. You can workaround this by changing the owner of the actionlist or the complete frame to the form while the frame is attached to the panel. Changing the owner after creation can be done with InsertComponent
.
Owner is mostly about lifetime management. But there is at least poOwnerFormCenter which uses Owner for a totally different purpose. And you probably stumbled over another purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With