Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid makes current record top record, pushes others off scrn
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Grid makes current record top record, pushes others off scrn
Divers
Thread ID:
00363346
Message ID:
00363346
Vues:
42
I've got a grid that displays several records. The table has order set on a field named aal_order, an ordinal number. Users need to be able to reorder the records.

I have implemented functions to do this in a spinner (code below), but my problem is if I move a record down to the bottom, it becomes the top row displayed and pushes the rest off. I have tried checking RelativeRow and using the DoScroll function without success; I want to keep the currently selected record selected, so a GO TOP doesn't help me. Any suggestions?

Thanks!
JP
----
Upclick:
LOCAL cOrder, cNewOrder, nRecno
SELECT tmpmixes
nRecno = RECNO()
* Reject if already top entry
GO TOP
IF RECNO() = nRecno THEN
RETURN
ENDIF
GO nRecno
* Swap places with the one above it.
cOrder = tmpmixes.aal_order
SKIP -1
cNewOrder = tmpmixes.aal_order
REPLACE aal_order WITH cOrder
GO nRecno
REPLACE aal_order WITH cNewOrder
THISFORM.grdMix.Refresh

Downclick:
LOCAL cOrder, cNewOrder, nRecno
SELECT tmpmixes
nRecno = RECNO()
* Reject if already bottom entry
GO BOTTOM
IF RECNO() = nRecno THEN
RETURN
ENDIF
* Swap places with the one below it.
GO nRecno
cOrder = tmpmixes.aal_order
SKIP 1
cNewOrder = tmpmixes.aal_order
REPLACE aal_order WITH cOrder
GO nRecno
REPLACE aal_order WITH cNewOrder
THISFORM.grdMix.Refresh
IF THISFORM.grdMix.RelativeRow = 1 THEN
THISFORM.grdMix.DoScroll(0)
ENDIF
Répondre
Fil
Voir

Click here to load this message in the networking platform