Given a handle, set focus to the form, how to, please?

G

Guest

Hi! I am trying to solve the problem of Ctrl+Tab to navigate between child forms of an MDI container. The problem is when
the child forms host the infamous WebBrowser control, doing Ctrl+Tab will not activate the next child form. It takes 4 Ctrl+Tab's to activate the next child. I have the toolbar and statusbar controls on all child forms and that's where Ctrl+Tab is going before switching to another form.

To make the short story long, I am intercepting the keyboard events using PreFilterMessage() and raising a notify event to the parent form. I pass the child window's handle to the parent. That's where I wish to remove focus from the child form and set the focus to the next form in MDIChildren list. I am having a hard time

1) Based on the handle, remove the focus from the child form. How, please
2) Finding the next child in MDIChildren and setting focus to it. How, please

Am I on the right track ? Am I doing something really stupid(probably)

Any input is greatly appreciated

Thank you in advance

--Sam
 
A

Alok

Loop thru the MdiChildren Array of the parent form.
Check the handle against each form in the MdiChildren. If it matches, remove
the focus and get the next form from the collection.

HTH :)

Sam D. said:
Hi! I am trying to solve the problem of Ctrl+Tab to navigate between child
forms of an MDI container. The problem is when
the child forms host the infamous WebBrowser control, doing Ctrl+Tab will
not activate the next child form. It takes 4 Ctrl+Tab's to activate the next
child. I have the toolbar and statusbar controls on all child forms and
that's where Ctrl+Tab is going before switching to another form.
To make the short story long, I am intercepting the keyboard events using
PreFilterMessage() and raising a notify event to the parent form. I pass the
child window's handle to the parent. That's where I wish to remove focus
from the child form and set the focus to the next form in MDIChildren list.
I am having a hard time :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top