General information
Category:
Forms & Form designer
Title:
Grid makes current record top record, pushes others off scrn
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
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only