Right Clicking a MDI child form does not change the focus to the form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Wyrwas
    New Member
    • Aug 2010
    • 2

    #1

    Right Clicking a MDI child form does not change the focus to the form

    My main program is a Multiple Document Interface (MDI). I create and show 2 or more child forms inside the MDI parent. If I left click on the child forms, the focus and Z-index will change correctly. (E.G. I have form1 and form2 as the child forms, form1 is active. I left click anywhere on form2 and the focus and z-index changes). This works correctly.

    However, if I right click on the non-active form the focus and z-index does not change. In my program I have context menus for the forms; these context menus appear correctly, but again, the focus and z-index does not change.

    I created a simple test program: a MDI parent form with the containing area and a button to create new forms. The new button does:

    Code:
    Form childForm = new Form(); 
    childForm.MdiParent = this; 
    childForm.Show();

    With this, the same issue arises. I can switch focus and z-index by left clicking between the child forms but I cannot switch by right clicking. I also checked the MDIChildActivat e event. This event is fired when I left click, but not when I right click.

    I checked Excel (2003) and right clicking does change the focus and z-index. So my assumption is that it is a bug. My hope is that I can find a workaround that doesn't involve adding code to everyone of my child forms.



    I know that if .Show() is called on a child form (or any of its components) before its parent is set, a bug happens were the user can only switch between the child forms by clicking on their titlebars or form edges. I discovered this bug a while back, but did not realize that Right clicking had the same symptoms and was not corrected when I moved any .Show() events in the form to code after .MdiParent was set.

    Would this question be more applicable in the c# forum? I'm not sure if this bug happens in Visual Basic or if its just c#.
  • Joe Wyrwas
    New Member
    • Aug 2010
    • 2

    #2
    Was anyone able to duplicate this bug?

    Comment

    Working...