Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Rows in Grid
Message
From
07/01/2002 15:42:17
 
 
To
07/01/2002 15:22:06
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00601625
Message ID:
00601633
Views:
30
Hello Greg.

Unless I'm completely misunderstanding how the BeforeRowColChange and AfterRowColChange events work, I don't understand why the following doesn't work, ie. highlight the current row in a grid.

Actually, I think that you are misunderstanding they way that these events fire as well as how DynamicBackColor works < s >

*nORecNo and nNRecNo are custom properties

*BeforeRowColChange
thisform.nORecNo=RECNO()

*AfterRowColChange
thisform.nNRecNo = RECNO()
thisform.grdSearch.SetAll("DynamicBackColor","iifthisform.nnrecno=thisform.norecno)," + ;
allt(str(RGB(0,255,0)))+ "," + allt(str(RGB(255,255,255))) + ")")


The condition Thisform.nnRecNo = ThisForm.noRecNo will never evalutate to true. In the grid's BRCC, the record pointer is on RECNO( n ). In the grid's ARCC, the record pointer has moved and is now on RECNO( n + 1 ). If you want to highlight the current row in the grid, this code in the grid's init
*** Set up for highlighting current row
This.nnRecNo = RECNO( This.RecordSource )
This.SetAll( 'DynamicBackColor', ;
	'IIF( RECNO( This.RecordSource ) = This.nnRecNo, RGB( 0,255,255 ), RGB( 255, 255, 255 ) )', 'COLUMN' )
Then, in the Grid's ARCC:
Thisform.LockScreen = .T.
This.nnRecNo = RECNO( This.RecordSource )
This.Refresh()
Thisform.LockScreen = .F.
You only have to set the DynamicBackColor property once (i.e., in the grid's init). It is evaluated every time the grid is refreshed.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform