Wiki Home

VFP Grid Behavior


Namespace: WIN_COM_API
Q. My grids go blank when I refresh the underlying data? What's with that?

A. See Grid Safe Select, and also the MS KB article Q140653 Offsite link to http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q140653, "A cursor-based grid is blank if the SELECT-SQL command resets the cursor in Visual FoxPro". Also, this article: Controlling Visual FoxPro grid data dynamically.


Q. We have several grids in an application. The controls within the columns of the grids are disabled or enabled within the code based on how the user interacts with the application. When we set focus to a column, if there is a disabled control in the the column the grid scrolls so the next column without a disabled control is visible. The problem is that we don't want it to scroll at all. How do we avoid this? Is this a bug or "by design"? If it's a bug, was this behavior fixed in Visual FoxPro 9? Any ideas? -- Jim

A. Could you make the controls Read-Only instead of disabling them? I think box in the grid takes on the behavior of the control it contains. If the control is disabled, the grid-box will be disabled and wont take the focus. I believe. - Tom Bellin


A.
I have found that this works pretty well.

thisform.grdGridName.recordsource = ""
=requery('Whatever_Needs_To_Get_Requeried')
thisform.grdGridName.recordsource = "Whatever_Needs_To_Get_Requeried"

You might even consider framing this with a thisform.lockscreen = .t. then make it .f. when those 3 lines are done.
-hb


Category VFP Controls
( Topic last updated: 2011.12.16 09:21:34 AM )