Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordMark in Grid does not follow

Status
Not open for further replies.

andre65

Programmer
Jan 19, 2003
95
NL
Hi all,

I have noticed that the grid's recordmark doesn't always change when programmaticly moving the recordpointer (by using for example SKIP 1) at a time the Grid has not the focus. When clicking on the grid's header and becomes the focus, the recordmark moves to the right position.

Is there a way to avoid this problem?
I already tried THISFORM>REFRESH(), but that doesn't help.

Thanks for any reply,
Andre
 
The solution is to resize the grid for only one row to fit and then resize back. The record mark will be updated, but the new record will be always the first in grid (maybe better).
See the code below, is from a modal search form with Find/Find again options. If the calling form has a grid that need to be refreshed, it pass the grid reference to search form. Maybe you can adapt the code to see if works for you.
Code:
*if there is a grid on calling form to be updated, ref is passed as parameter
*oFormRef - calling form reference passed to search form
*oGridRef - reference to grid that need to be refreshed
IF !ISNULL(thisform.oGridRef)
	thisform.oFormRef.LockScreen = .t.
	WITH thisform.oGridRef
		lnH = .height
		*resize the grid to display only one row
		.height = .headerheight+SYSMETRIC(8)+.GridLineWidth*2+.RowHeight
		.refresh
		.ActivateCell(1,1)
		.height = lnH
	endwith
	thisform.oFormref.LockScreen = .f.
ENDIF
 
Hi

Assuming you are doing this code from your navigational buttons, for example,

when you do the movement of the pointer in the table, follow that with the code...

ThisForm.Grid1.SetFocus() && transfer focus to Grid.
This.SetFocus() && to getback the focus.

This way, the grids record pointer gets positioned properly in the Grid.

:)

ramani :)
(Subramanian.G)
 
Thank you all for replying.
I tried Ramani's solution, it works fine.

Thanx,
Andre
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top