Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid
Message
De
21/07/2002 23:46:55
 
 
À
21/07/2002 13:13:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: Grid
Divers
Thread ID:
00680892
Message ID:
00681002
Vues:
20
>the problem is simple.
>i have a grid who is link to a table who is father for two other table.
>in first column in "thisform.grid1.column1.text1" method "keypress" i open another form.i chose an article and when release the second form and come back in the first form i must move the pointer (go top and then go record (record is the last article of table) for another reason;
>and the problem is :the grid display the record (the last in this case) in the first line of a grid, and i want to be display somewhare on the middle of grid.
>thanke you and sory for my english


You need to use Grid.RelativeRow and Grid.DoScroll().

Here is some sloppy sample code to demonstrate centering the current record within the grid:
#DEFINE SCROLL_UP    0
#DEFINE SCROLL_DOWN    1

nDesiredRow = 5		&& We want our current record to be displayed in this row.

thisform.LockScreen = .t.	&& Lock screen so our grid scrolls aren't visible.

WITH thisform.grid1
	.setfocus	&& Grid must have focus for RelativeRow property to be valid.
	.refresh	&& update grid so the "current" record is visible.
	DO CASE
	CASE .RelativeRow < nDesiredRow
		* Current record is displayed above where we want it.  Scroll grid up.
		FOR nScroll = 1 TO (nDesiredRow - .RelativeRow)
			.DoScroll(SCROLL_UP)
		ENDFOR
	CASE .RelativeRow > nDesiredRow
		* Current record is displayed below where we want it.  Scroll grid down.
		FOR nScroll = 1 TO (.RelativeRow - nDesiredRow)
			.DoScroll(SCROLL_DOWN)
		ENDFOR
	OTHERWISE
		*  Either we're already in the right spot, or RelativeRow is 0.
	ENDCASE
ENDWITH
thisform.lockscreen = .f.
I haven't used this technique much, so I can't guarantee that it will work in all situations.

-Tom

This post is provided "AS-IS" with no warranties, and confers no rights.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform