I have a list of TPanels
in a FMX application and I want to free a panel if I click on it.
To free them directly in the Onclick-handler is not the right way, because I get an access-violation. And I don't want to use windowsmessages
(recommended in How to free control inside its event handler? and Why does my program crash when I destroy a button in its own OnClick handler?) because it is a firemonkey application and I do not know how these messages work on android and mac.
Is there another solution?
Use myObject.Release
:
Marks this TFmxObject object for delayed deletion.
Immediate actions in this method:
Delayed action:
vPurgatory
).Remember, that method Free
(and procedure FreeAndNil
) does not remove the object itself in mobile platforms:
// under ARC, this method isn't actually called since the compiler translates // the call to be a mere nil assignment to the instance variable, which then calls _InstClear
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