Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Highlight record on grid as table index moves
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00908074
Message ID:
00908077
Views:
20
As I search a record from a table bound to the Grid as its Recordsource, I want the record in the grid highlighted,

You do not say which version of VFP you are using. In version 8, all you need to dois set the grid's HighLightStyle property to 2-Current Row Highlighting with Visual Persistence.

Then, all you have to do is issue a grid.Refresh() in your code after you move the record pointer.

I earlier versions of VFP, you need to add a custom property to your grid called nRecNo and use code like this in the grid's Init to set up the highlighting:
*** 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' )
In the AfterRowColChange, you put code like this:
Thisform.LockScreen = .T.
This.nRecNo = RECNO( This.RecordSource )
This.Refresh()
Thisform.LockScreen = .F.
As in VFP 8, you need to Refresh the grid after the record pointer is moved.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform