• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 990
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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