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?
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.
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.