Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid
Message
De
15/09/1999 17:35:13
Jill Derickson
Software Specialties
Saipan, CNMI
 
 
À
15/09/1999 01:28:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Grid
Divers
Thread ID:
00264821
Message ID:
00265218
Vues:
15
If I understand you correctly, you are adding records to a table and want to be sure that the last (bottom?) record displays in the grid?

I use a Grid class that does just that.

Two Grid properties are:

nRelRow = 0 && used to position last row of the table at the bottom of the grid
nRows = 0 && number of rows displayed in grid

The refresh method of the grid:

PROCEDURE Refresh

** position grid so that last row is displayed
lScreenWasLocked = THisForm.LockScreen
ThisFOrm.LockScreen = .T.
SELECT ( This.RecordSource )
WITH This
nRecs = RECCOUNT()
GO TOP
IF nRecs > 0
IF nRecs <= .nRows
GO Bottom && they all fit
ELSE
GOTO nRecs - .nRows + 1 && top record to display in grid
x = 2
DO WHILE x > 1 && scroll down until relative row is 1
.DoScroll( 1 )
.SetFocus
.Columns[1].Text1.GotFocus
x = .nRelRow
ENDDO
ENDIF
ENDIF
EndWith
ThisFOrm.LockScreen = lScreenWasLocked
EndProc && Refresh
ENDDEFINE && ledgerGrid


In the GotFocus of the textbox:

PROCEDURE GotFocus

This.Parent.Parent.nRelRow = This.Parent.Parent.RelativeRow
ENDPROC

HTH...someone else passed it on to me.

J
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform