• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1007
  • Last Modified:

'Cannot focus a disabled or invisible window' on Win98, not XP.

Hi,

I use Delphi 7 Studio Enterprise on two machines (no network, just for comparison). The application I have runs on the XP machine flawlessly, but on the Windows 98 machine I keep getting "Project raised exception class EInvalidOperation with message 'Cannot focus a disabled or invisible window'. Process stopped. Use Step or Run to continue.

When I close the errormessage, the code that raised the exception turns out to be:

procedure TPropertyFrm.ShowContents(XObject : TObject);
begin
   IL_Property.Assign(MyProgramMain.IL_Nav);
   m_Closing := FALSE;

   if ED_Caption.Visible and ED_Caption.Enabled then
   try
      ActiveControl := ED_Caption;   //   <------- here is the hangup
   except
   end;
     
   DoDataExchange(FALSE);
end;

I compared the installation settings on both standalone machines and made the as similar as possible. Yet the problem stays.

What do you make of this?

Thanks,
Ron dW
0
Ron_de_Weijze
Asked:
Ron_de_Weijze
3 Solutions
 
rmaranhaoCommented:
The debug setting "Stop on Delphi Exceptions" is the same in both machines?
0
 
esoftbgCommented:
I think it is impossible .exe file to raise an exception inside the construction
   try
   except
   end;
i guess
   if ED_Caption.Visible and ED_Caption.Enabled then
raises the exception
Place a breakpoint on this row
   IL_Property.Assign(MyProgramMain.IL_Nav);
and when the application stops there use F8-Step over.

May be the code needs to be:
   if Assigned(ED_Caption) then
   if ED_Caption.Visible and ED_Caption.Enabled then

I hope it will be helpful.
0
 
mokuleCommented:
Hi, better believe the message.

You checked
  if ED_Caption.Visible and ED_Caption.Enabled then
so it must be its parent problem or parent parent or ..
 
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Ron_de_WeijzeAuthor Commented:
The first comment was right. I had overlooked the 'Stop on Delphi exceptions' setting on the Win98 machine.

Thank you!
Ron dW
0
 
mokuleCommented:

But the problem, so hidden, remains :)
0
 
Ron_de_WeijzeAuthor Commented:
That's right, but this will do for now. Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now