*this code build a grid at runtime to request data in cursors from a source table (dont opened) *a timer makes this request all 4 seconds.The source table could also changes its data. *can stop or start the timer work in a button *can resize the form (or maximize it) Publi yform yform=Newobject("ygrid_runtime_viewer") yform.Show Read Events Retu * Define Class ygrid_runtime_viewer As Form Height = 444 Width = 770 ShowWindow = 2 AutoCenter = .T. Caption = "View refreshed with requested random data all 4 seconds." BackColor = Rgb(0,0,0) Name = "Form1" Add Object grid1 As Grid With ; Anchor = 15, ; Height = 408, ; Left = 0, ; Top = 36, ; Width = 768, ; Name = "Grid1" Add Object timer1 As Timer With ; Top = 0, ; Left = 648, ; Height = 23, ; Width = 23, ; Interval = 4000, ; Name = "Timer1" Add Object label1 As Label With ; AutoSize = .T., ; FontBold = .T., ; FontName = "Segoe Script", ; FontSize = 12, ; Anchor = 768, ; BackStyle = 0, ; Caption = "", ; Height = 29, ; Left = 12, ; Top = 2, ; Width = 2, ; ForeColor = Rgb(255,0,0), ; Name = "Label1" Add Object command1 As CommandButton With ; AutoSize = .T., ; Top = 4, ; Left = 689, ; Height = 27, ; Width = 80, ; FontBold = .T., ; Caption = "Stop", ; MousePointer = 15, ; BackColor = Rgb(255,128,0), ; Name = "Command1" Procedure yrequest Rand(-1) Sele * From Home(1)+"samples\data\customer.dbf" Into Cursor ycurs &&for ex customer.dbf can change dynamically Sele ycurs Local m.x,m.v m.x="" For i=1 To 5 &&fcount() m.v=Int((Fcount())*Rand( ) + 1) If i=1 m.x=m.x+Field(v) Else m.x=m.x+','+Field(v) Endi Endfor With Thisform.label1 .Caption=m.x .ForeColor=Rgb(255*Rand(),255*Rand(),255*Rand()) Endwith TEXT to m.xsql textmerge noshow sele <<m.x>> from home(1)+"samples\data\customer" into cursor zcurs ENDTEXT =Execscript(m.xsql) With Thisform.grid1 .RecordSource="" .RecordSource="zcurs" .RecordSourceType=1 .Anchor=15 .DeleteMark=.F. .GridLines=0 .RowHeight=20 .Themes=.F. .SetAll("width" ,Thisform.Width/5,"column") .SetAll("backcolor",0,"header") .SetAll("forecolor",Rgb(0,255,0),"header") .SetAll("fontbold",.T.,"header") .SetAll("DynamicBackColor","IIF(MOD(RECNO( ), 2)=0, RGB(212,208,200), RGB(140,255,100))", "Column") .Refresh Endwith Endproc Procedure Init Thisform.yrequest() Thisform.timer1.Enabled=.T. Endproc Procedure timer1.Timer Thisform.yrequest() Endproc Procedure command1.Click Thisform.timer1.Enabled=!Thisform.timer1.Enabled This.Caption=Iif(Thisform.timer1.Enabled=.T.,"Stop","Start") Endproc Procedure destroy clea events endproc Enddefine * *-- EndDefine: ygrid_runtime_viewer