I have a parent-child form with a grid containing the child records. I ahve add the following code the grid to highlight the current row:
in the init method of grid:
*** Set up for highlighting current row
This.nRecNo = RECNO( This.RecordSource )
This.SetAll( 'DynamicForeColor', ;
'IIF( RECNO( This.RecordSource ) = This.nRecNo, RGB( 0, 0, 128 ), RGB( 0, 0, 0 ) )', 'COLUMN' )
This.SetAll( 'DynamicBackColor', ;
'IIF( RECNO( This.RecordSource ) = This.nRecNo, RGB( 0,255,255 ), RGB( 255, 255, 255 ) )', 'COLUMN' )
WHEN event of grid:
This.LeaveGrid = .F.
VALID event of grid:
This.LeaveGrid = .T.
BEFOREROWCOLCHANGE event of grid:
IF !This.LeaveGrid
This.nRecNo = 0
ENDIF
WHEN event of each column in grid:
WITH THIS.PARENT.PARENT
.nRecNo = RECNO(.RECORDSOURCE)
It appears to work fine for records already in the grid, but when you add a record to the grid, the row for each record that u have added is highlighted, instead of just the current row.
Is there a way to correct this or does it have to do something with the buffermode. I have set the buffer mode to 5 for the child table.
Regards,
Stuart
Stuart Reid
True nobility lies not in being superior to another man, but in being superior to one’s previous self