PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN DEFINE CLASS form1 AS form Top = 0 Left = 0 Height = 314 Width = 479 DoCreate = .T. Caption = "Form1" BindControls = .F. AllowOutput = .F. Name = "Form1" ADD OBJECT command1 AS commandbutton WITH ; Top = 16, ; Left = 274, ; Height = 27, ; Width = 90, ; Caption = "No focus", ; Name = "Command1" ADD OBJECT command2 AS commandbutton WITH ; Top = 16, ; Left = 372, ; Height = 27, ; Width = 72, ; Caption = "Focus", ; Name = "Command2" ADD OBJECT grid1 AS grid WITH ; ColumnCount = 1, ; Height = 200, ; Left = 50, ; Top = 68, ; Width = 320, ; Name = "Grid1", ; Column1.Name = "Column1" ADD OBJECT command3 AS commandbutton WITH ; Top = 18, ; Left = 50, ; Height = 27, ; Width = 84, ; Caption = "BIND", ; Name = "Command3" PROCEDURE showinfo debugout "RECNO()",RECNO()," relativerow",THISFORM.GRID1.RelativeRow ENDPROC PROCEDURE Load ACTIVATE WINDOW "Debug Output" CREATE CURSOR testGrid (f1 i) FOR k=1 TO 100 APPEND BLANK NEXT LOCATE ENDPROC PROCEDURE command1.Click debugout "***** NO FOCUS REFRESH *****" DEBUGOUT "GRID'S RELATIVEROW == 0" thisform.grid1.Refresh && sync grid debugout "***** FORM PAINT FIRE ANOTHER CYCLE *****" DOEVENTS FORCE && FLUSH THE PAINT QUEUED debugout "***** NO FOCUS END *****" ENDPROC PROCEDURE command2.Click DEBUGOUT "***** SET FOCUS *****" DEBUGOUT "GRID'S RELATIVEROW == RELATIVEROW OF THE SELECTED ROW" thisform.grid1.SetFocus DEBUGOUT "***** IN FOCUS *****" DEBUGOUT "GRID'S RELATIVEROW == RELATIVEROW OF THE SELECTED ROW" thisform.grid1.Refresh debugout "***** REFRESH END *****" debugout "***** FORM PAINT FIRE ANOTHER CYCLE *****" DOEVENTS FORCE && FLUSH THE PAINT QUEUED debugout "***** LOST FOCUS DO A DYNAMIC ON THE SELECTED ROW *****" this.SetFocus ENDPROC PROCEDURE grid1.Init THIS.SetAll("dynamicFontShadow","thisform.showInfo()") ENDPROC PROCEDURE command3.Click DEBUGOUT "***** recoursource binding ****" DEBUGOUT "GRID'S RELATIVEROW == 0" thisform.Bindcontrols = .T. thisform.Draw && Flush the draw buffer DEBUGOUT "***** recoursource binding END ****" ENDPROC ENDDEFINE