MDIForms and Focus?

A

andreas.baus

Is there any way for a MDI child form to be notified when it's parent
receives focus? In my example, I have a MDI application with several
child forms, and one of them contains a "Paste from Clipboard" button
which I want to dynamically enable/disable depending on whether there's
actually any data in the clipboard in a format that I can make use of.
I wanted to do the check and update when the form receives focus, but
unfortunately events like "Enter" on the child window only fire when
the focus switches among the child windows of the same parent. However,
if I switch focus to another application (to copy something to the
clipboard), then swtich back to my own app, the child form receives no
such event. So I was wondering if there was some other way to keep the
button up-to-date.

Trying to attach to the MDIParent's events didn't work (with something
like
"this.MdiParent.Enter += new EventHandler(GotFocus);").

Any suggestions are welcome.
 
C

Chris Jobson

Is there any way for a MDI child form to be notified when it's parent
receives focus? .... snip ...
Trying to attach to the MDIParent's events didn't work (with something
like
"this.MdiParent.Enter += new EventHandler(GotFocus);").

I think that attaching to the MdiParent's Activated event might work.

Chris Jobson
 

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