* Grid.Init && add a property to the grid to track the highlighting row this.AddProperty("nGridRecNo") this.nGridRecNo = 0 this.DeleteMark = .F. this.RecordMark = .F. this.HighLightRow = .F. * this.SplitBar=.F. && Set up this in design time, cannot change this in run-time. this.ScrollBars = 3 && or 2 if all columns fit into the visible area && If you have no horizontal scrollbar, last grid column width should be 1 point less than && required to fit last column into the visible portion of grid (1 point gap between the right && edge of the last column and the left edge of the scrollbar). This to avoid grid auto-scroling && (jumping) when cell in the last column is selected this.GridLines = 2 && vertical setupcolumn(this.Columns(1)) setupcolumn(this.Columns(2)) * Grid AftreRowColChange event code if this.nGridRecNo<>recno(this.RecordSource) this.nGridRecNo = recno(this.RecordSource) this.Visible = .T. && (UPDATED) was this.Refresh && setting this.Visible is enough. This will refresh the && highlighting row correctly, but works more quickly than && this.Refresh because it does not re-read the data to determine && if rows should be re-arranged accordingly to filtering/sorting. endif && note that you can use Grid Highlighter to highlight current row procedure SetupColumn && make it as a form or grid class method lparameters poColumn && assuming default textbox is in the grid lnColor = RGB(0,200,200) && or whatever color you want for row highlighting with poColumn .Movable = .F. .Resizable = .F. .ReadOnly = .T. .DynamicBackColor = "iif(recno('" + .parent.RecordSource + "')=this.nGridRecNo," + ; allt(str(lnColor))+ "," + allt(str(.BackColor)) + ")" .Text1.DisabledBackColor = lnColor .Text1.BackColor = lnColor .Text1.DisabledForeColor = .Text1.ForeColor .Text1.ReadOnly = .T. .Text1.Margin = 1 && required, so no jumping when selecting cell endwithYou can also use the SetAll method to setup each column properties.
DO WHILE .T. ME.Work() ENDDO