Visual FoxPro grid question

What is the best way to detect whether or not a VFP9 grid has the focus?

I want to be able to open a form containing several grids, each showing its column headers and one row of data, then expand a grid when it gets focus and shrink it back to its original size when it loses focus.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You may use When and Valid events of the Grid control and change the Height property appropriately.

When is fired when grid obtains focus, Valid is fired when the grid looses focus.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pavel's answer is correct, but you have to ask yourself if that is REALLY what you want to do.
What will dynamically changing one Grid's height do to the appearance of the other parts of your Form?

Other approaches might include:
1)   Stack your full-sized Grids one on top of the other and then use a button group on your form to allow the user to select which Grid they want.  
       When selected, you can bring that Grid forward above the others.
2)  Put full-sized Grids on separate Tab pages of a Form's PageFrame with each PageFrame tab caption identifying which Grid it will display.

Good Luck
GEOFSAuthor Commented:
jrbbldr - Well, no, I'm not REALLY sure that's what I want to do, but I won't know for sure without trying it and I couldn't try it without a way to know when a grid get the focus.  I appreciate the other design ideas that you suggested.

Pavel - I will try it using the WHEN and VALID events as soon as I can and report back.
GEOFSAuthor Commented:
Thanks, Pavel, for your tip.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.