PRB: Incremental Search with Grid Causes Screen Flicker
Article ID: 156630
Article Last Modified on 10/15/2003
APPLIES TO
- Microsoft Visual FoxPro 5.0 Standard Edition
- Microsoft Visual FoxPro 6.0 Professional Edition
This article was previously published under Q156630
SYMPTOMS
The Refresh method of the Grid control does not move the record pointer in
the grid to the selected record when the record pointer is moved from a
control external to the grid. The grid has to get the focus in order for
the record pointer in it to move to the selected record. Because of this
problem, an incremental search routine, involving the grid and another
control, causes the screen to flicker every time a character is entered.
This article describes a way to avoid the screen flicker when using an
incremental search routine with a grid.
WORKAROUND
You can use the LockScreen property of the Form to eliminate most of the
screen flicker. For example, you can make the following modifications to
the Form created in the STEPS TO REPRODUCE BEHAVIOR section below:
- Create a New Property for the Form and name it lRefreshingGrid. Set
the property to .F.
- Change the code in Text1.InterActiveChange event as follows:
ThisForm.lRefreshingGrid = .T.
ThisForm.LockScreen = .T.
SELECT customer
SEEK UPPER(ALLTRIM(ThisForm.Text1.Value))
ThisForm.grid1.SetFocus
ThisForm.text1.SetFocus
ThisForm.LockScreen = .F.
ThisForm.lRefreshingGrid = .F.
- To ensure that the Valid event of the text box does not fire when the
focus is moved to the grid and then back to the text box, add the
following code to the Valid event of the text box:
IF ThisForm.lRefreshingGrid
RETURN .T.
ENDIF
STATUS
Microsoft is researching this behavior and will post new information here
in the Microsoft Knowledge Base as it becomes available.
Additional query words: kbdse VFoxWin Flash
Keywords: KB156630