I realize that this is a bug in my program, and I fix things like that when
I find them. But there are times when it results in a lot of extra code just
to avoid this exception.
So I'd like to disable the appearance of this exception, so my users never
see it.
Is there a way to do that?
Bad idea. Problems should be fixed, not hidden.
> Is there a way to do that?
You can use the Application.OnException event. It gets all the
exceptions trapped in the VCL and you can decide there to show the
exception or not.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Thanks!
"Peter Below (TeamB)" <no...@nomail.please> wrote in message
news:xn0fqu13...@newsgroups.borland.com...
Implement the modified focus code in that routine....
Ex,
function MySetFocus(aWinControl: TWinControl): boolean;
function ParentsEnabled(const aParent: Twincontrol): boolean;
begin
Result := not Assigned(aParent);
if not Result then
Result := aParent.Enabled and aParent.Visible and
ParentsEnabled(aParent.Parent);
end;
begin
Result := Assigned(aWinControl) and aWinControl.Enabled and
aWinControl.Visible and
ParentsEnabled(aWinControl.Parent) and aWinControl.CanFocus;
if Result then
begin
aWinControl.SetFocus;
Result := aWinControl.Focused;
end;
end;
This code dows not fully catch the problem... Then main drawback is when
using dynamic control which are not place on a Form as to level parent....
Ex.
TForm (does nog have a parent!)
TPanel
TButton
TEdit
This wil do ok
TForm (does nog have a parent!)
TPanel
TButton
TEdit (does nog have a parent!)
This we result in a error
--
Regards,
Ronald Hoek
Applicationdevelopper
ComponentAgro B.V.
Its's not pretty, but it got rid of the errors.
Rgds,
Martin