Question on MDIchild forms

  • Thread starter Thread starter Wan Andii
  • Start date Start date
W

Wan Andii

I have two MDI Child forms that are created in a MDI Parent. Here is
the issue when switching between
the two child forms by clicking anywhere on the child forms (Not just
their titlebars) the input focus shifts but the forms do not get the
focus (bringtofront). Also under MDI 'Window Menu' the forms do not
have the correct check order. The childforms have panels, groups,
textboxes etc. Perhaps I'm going about this the wrong way
Any feedback is appreciated. Thanks in advance
- Wan

---------------------------------
Public mMDIParent As Form (in datamodule)

' --- In MDI form (on load event)...
Dim form1 As New Form1
form1.MDIParent = Me
mMDIParent = Me
form1.Show()

' --- In form1 (on button click event)...
Dim form2 As New Form2
form2.MDIParent = mMDIParent
form2.WindowState = FormWindowState.Normal
form2.Show()

run the application...
 
Hello, Wan,

When I try your code (with simple forms - no panels, groups or textboxes,
etc.) I do not have the problem you describe.

Perhaps something in other code is interfering with the activation of the
forms. Or another possibility... What version are you using? Your
description sounds similar to a problem I experienced under VB2003 that I
could only correct by upgrading to VB2005.

Cheers,
Randy
 
Thanks Randy for the feedback. I'm using VB2005. If I use the form1 &
form2 with out the MDI then clicking anywhere on the forms
works fine. Also I tried with new MDI form and still the same issue.
I checked load & activate events on these child forms and didn't
find anything that might be interfering with the activation.
Thanks - Wan
 
Hello, Wan,

If you replace the "real" child forms you are using with trivial forms (i.e.
no controls other than the button on Form1 that is used to show Form2, and no
additional code on either form) does the problem still occur?

Cheers,
Randy
 
Thanks Randy for your time. Yes, I tried this suggestion a couple of
days and narrow down the problem. Here is what I found: if trivial
forms
contain a group box and a button then application works fine.
However,
the problem comes back when I add (copy/paste) "TabControl" from the
"real' child form to the test form. Hopefully this finding would
help
someone to solve this issue.

Thanks
Wan.
 
Hello, Wan,

Perhaps one of the controls on the form is interfering in some way. If you
replace Form1 and Form2 with forms that are empty (except for the button on
Form1 that shows Form2) do you still have the problem?

Cheers,
Randy
 
Hi, Wan,

Sorry for the similar post that followed yours in time. The web site does
not seem to be updating in a timely fashion and I thought my earlier post had
been lost. Also, I'm not receiving any e-mail prompts about new postings, so
apologize for delays in my response.

I would next look to see if there is any code associated with TabControl (or
contained TabPage) events that could be causing a problem. In particular, is
there any code handling the Enter or GotFocus events for these controls?

Cheers,
Randy
 
Back
Top