GotFocus/LostFocus

J

Jim Franklin

Hi,

This might be a silly question but I am confused about one thing:

What exactly defines when a form receives and loses the focus? I have a
continuous main form which contains a number of command buttons which open
other forms on top, some popup, some fullscreen. I want to run some code
that switches off the timer interval whenever another form is opened on top
of my main form, and back on again whenever the main form becomes active
again.

It now works using the Activate and DeActivate events. However I first tries
using GotFocus/LostFocus. Even though the focus was clearly moving from one
form to another and back again, neither of these events fired.

Am I missing something?

Jim F.
 
K

Ken Snell

To add to Larry's comment, a form receives focus ONLY IF there are no
controls on the form that can receive the focus. Using the
Activate/Deactivate events, as you're doing, is the way to handle what you
want to accomplish.
 

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