troubleshooting Question

Cannot focus a disabled or invisible window.

Avatar of light_bulb
light_bulbFlag for United States of America asked on
Delphi
19 Comments1 Solution10724 ViewsLast Modified:
Hello,

I have a form that contains several buttons on top, and form container in the middle.  I'm using BilleniumSoft's TFormContainer for this.  Basically, the user clicks one of the buttons, and the appropriate form is shown in the container.  However, on one particular button/form, I'm getting an error in the debugger.  It says "Cannot focus a disabled or invisible window."  Here's the code that occurs when the user clicks the button to change to this form:

Procedure TfrmMain.PageButtonClick(Sender: TObject);
Begin
    currentPageIndex := (Sender As TComponent).Tag;
    Try
        fcQOC.ShowForm(myForms[currentPageIndex], False);
    Except
        ; // I'm ignoring exceptions at runtime, so this exception only shows up in the debugger.
    End;
    PushPageButton(currentPageIndex);
End;

I've looked at this form that is to be called, and there's no SetFocus being called at the FCEmbeddedFormShow event, which is execute when the form is displayed.

I've not been using Delphi long, and I have no idea how to use the debugger to really track this problem down.  

Any ideas?  

Thanks,

Jason
ASKER CERTIFIED SOLUTION
MerijnB
Sr. Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 19 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros