Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting by columns in a grid
Message
From
05/11/2004 10:34:49
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00958466
Message ID:
00958504
Views:
16
Actually, if you ensure you have a PK index, SEEK would be faster.

>Instead of saving the record number, save the primary key or a unique value of one of the columns, then use LOCATE to go back to that record.
>
>John
>
>>I have a grid which the user can sort by any of the columns.
>>
>>Until recently, the user did this by right-clicking to get a pop-up menu, and one of the choices allowed sorting by the selected column. The sort routine would always do a "GOTO TOP" to put the user back at the top of the newly sorted grid.
>>
>>I have recently added the capability to click on the column header, which sorts immediately (no pop-up).
>>
>>Since these are now duplicate capabilities, I have been asked to modify the behavior when right-clicking on one of the rows in the grid: if the user chooses the option to sort the column, he still wants the grid sorted, BUT he wants to remain on the same record that he right-clicked on.
>>
>>I can't get this to work. Previously, by code looked like:
>>
>>    INDEX ON bla-bla-bla
>>    GOTO TOP
>>
>>which works properly, sending the user to the top record.
>>
>>The new code, which does not work properly, looks like:
>>
>>    lnRecNO=RECNO()
>>    INDEX ON bla-bla-bla
>>    GOTO (lnRecNO)
>>
>>This code doesn't fail, but appears to place the user on some random record in the grid.
>>In fact, on some occasions, it even gets the correct record.
>>
>>Any suggestions?
>>Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform