Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to let the cursor locate in corresponding place in g
Message
From
06/04/2002 11:25:44
 
 
To
06/04/2002 08:37:04
Michale Chen
Shijiazhuang ZhiYuan Crop.
Shijiazhuang, China
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00641757
Message ID:
00641817
Views:
23
Hello Michale.

In fact the pointer in the source table is point to the corresopinding record,in table,bu t in grid the corresopinding record not highlighting as if they selected?

Do you have code in your grid to hightlight the current row? This does not happen automatically. To do this, you need code like this in your grid class. First, you need to add two custom properties to your grid class. One is called nRecNo and the other is called lAbout2LeaveGrid. Set This.lAbout2LeaveGrid to .F. in the grid's When() and .t. in the grid's Valid().

Code like this in the grid's Init():
*** Set up for highlighting current row
loShell = CreateObject( 'WScript.Shell' )
lcColor = loShell.RegRead( 'HKCU\Control Panel\Colors\Hilight' )
lcBgColor = 'RGB( ' + STRTRAN( lcColor, ' ', ', ' ) + ' )' 
lcColor = loShell.RegRead( 'HKCU\Control Panel\Colors\HilightText' )
lcFgColor = 'RGB( ' + STRTRAN( lcColor, ' ', ', ' ) + ' )' 
lcNormalbg = 'RGB( ' + STRTRAN( loShell.RegRead( 'HKCU\Control Panel\Colors\Window' ), ' ', ', ' ) + ' )'
lcNormalFg = 'RGB( ' + STRTRAN( loShell.RegRead( 'HKCU\Control Panel\Colors\WindowText' ), ' ', ', ' ) + ' )'

This.nRecNo = RECNO( This.RecordSource )
This.SetAll( 'DynamicForeColor', ;
	"IIF( RECNO( This.RecordSource ) = This.nRecNo, " + lcFgColor + ", " + lcNormalFg + " )", 'COLUMN' )
This.SetAll( 'DynamicBackColor', ;
	"IIF( RECNO( This.RecordSource ) = This.nRecNo, " + lcBgColor + ", " + lcNormalBg + " )", 'COLUMN' )
Code like this in BeforeRowColChange:
IF !This.lAbout2LeaveGrid 
  This.nRecNo = 0
ENDIF	
Code like this in AfterRowColChange:
This.nRecNo = RECNO( This.RecordSource )
Thisform.LockScreen = .T.
This.Refresh()
Thisform.LockScreen = .F.
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform