Re: QC#6682 - is there a fix?
From: Kurt Barthelmess (kbarthelmess_at_compuserve.com)
Date: 12/22/03
- Next message: Anders: "Re: Large public source archives? Delphi file extensions?"
- Previous message: Os2: "Re: getting dll project name."
- In reply to: Pierre le Riche: "QC#6682 - is there a fix?"
- Next in thread: Pierre le Riche: "Re: QC#6682 - is there a fix?"
- Reply: Pierre le Riche: "Re: QC#6682 - is there a fix?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 22 Dec 2003 17:26:10 GMT
"Pierre le Riche" <pleriche@hotmail.com> wrote:
>If an exception is raised within the OnCreate event of a form and the
>exception is not handled inside the OnCreate itself, but there is a
>try...except...end block in the procedure that creates the form, the
>exception is not trapped properly. I've reported this as QC#6682, and I was
>wondering if anyone knows of a workaround?
>
>At the moment my solution is to do nothing in a form constructor that could
>raise an exception, but this is not always ideal. If anyone knows which
>lines of code to change in the VCL to fix this I would be very grateful.
Give the form which is throwing the exception (not the form which is
trying to create it) a method like so:
protected
function HandleCreateException: Boolean; override;
function TForm2.HandleCreateException: Boolean;
begin
Result := False;
end;
Note that OnCreate is called by your constructor, and the object will
destroyed before your exception code is allowed to execute. Therefore
the not be valid either in the exception handler or later.
Good luck.
Kurt
- Next message: Anders: "Re: Large public source archives? Delphi file extensions?"
- Previous message: Os2: "Re: getting dll project name."
- In reply to: Pierre le Riche: "QC#6682 - is there a fix?"
- Next in thread: Pierre le Riche: "Re: QC#6682 - is there a fix?"
- Reply: Pierre le Riche: "Re: QC#6682 - is there a fix?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|