On Fri, 13 Dec 2019, Luca Olivetti via lazarus wrote:
At least, that is how I see it. Not 100% accurate, but it does the trick
for my understanding ;-)
Yes, I know all of that, but the message loop could also fake re-raising
the exception if it was raised in the context of a ShowModal (though I
reckon that if it did that it would probably break existing
applications, or maybe not, since the exception would be finally caught
by the application handler anyway).
Not correct.
I have code
if ShowModal=mrOK then
begin
end
else
begin
end
No matter how many exceptions are raised, the code will always go through
either block of the if then statement.
If ShowModal would propagate this, then neither of the code blocks would be
executed.
So changing this is a no-no.
BTW, is there a way to know where the exception came from? I don't see
any method in Exception to do that, and that's the only parameter that
OnException sees (Sender is nil when I raise an exception inside a form).
My use case is, I want to manage only the exceptions generated in a
specific form while I'm modal showing it.
I usually set a field telling me that the form is visible and use that
in OnException to guess where it came from, but that will obviously fail
if the form is showing and there's an exception generated somewhere else.
Why not use Screen.ActiveForm ?
Michael.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus