Hi Gerard,
---
.... The problem is that after the sorting the selected record is lost. For instance: The user selects a value at line 3 in the grid and clicks on the label. The order changes, and the selected row in the grid is still line 3 while the value the user selectd is at line 10(only figurative numbers).
---
This is a bug for me.
When focus is on grid, grid.refresh reload the rows and grid force the relativeRow to still fixed ( correct choice ),
but instead changing ActiveRow, it changes RECNO() ( bad choice ).
---
What makes it even more strange is that when I put a ‘suspend’ or ‘browse’ anywhere in the code, the problem doesn’t occur.
This is because the grid have lost the focus, then RelativeRow and ActiveRow are undefined ( 0 ) and the internal routine with bug is not executed.
Not simple to resolve without:
- setfocus to another object
- order
- setfocus to the grid
Try to replace the label to order with a commandbutton;
click on command button force the focus on command before the click method fire,
and coding:
PROCEDURE CommandButton.click
.....
thisform.grid.setfocus
ENDPROC
another way is ( i not tested it):
PROCEDURE label.click
.....
thisform.grid.setfocus
ENDPROC
Fabio