Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00717530
Message ID:
00717669
Views:
19
This message has been marked as the solution to the initial question of the thread.
Before you sort, store the record number (A zero record will error out). After the sort, goto the record , refresh and set focus on the grid. The table will "center" the selected record and highkight the row.
 lnCurrentRecord=iif(eof() or bof(),0,recno())
.... do your sort routine
if lnCurrentRecord=0
   go top
else
   go lnCurrentRecord
endif
MyForm.MyGrid.Refresh
MuForm.MyGrid.Setfocus
>I have a grid that is working fine with one small annoyance (its based on a local view in a Child Form). I allow the user to "sort" the grid by column by having code similar to the following in the Column Header Click() of each column:
>
>THISFORM.SetOrder('category')
>THIS.Parent.SetFocus()
>
>It works fine except this: Let's say the current selected column is 1, and the first row and column is selected. I press the 2nd Column to sort by that row, and the sort is done correctly. However, what was the first row when the sort was in column 1 is now the last row and column in column 2. The problem is that all the other rows have now scrolled up and you can not see them until you scroll up the grid.
>
>The question is how to keep the other rows showing (at least as many rows as would appear in the size of the grid) without requiring the scroll up.
>
>Thanks,
>Mel Cummings
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform