Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change order, grid problem
Message
From
20/11/2003 10:46:11
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00851823
Message ID:
00851888
Views:
10
This message has been marked as the solution to the initial question of the thread.
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
.....
* grid.refresh probably not necessary
thisform.grid.setfocus
ENDPROC
another way is ( i not tested it):
PROCEDURE label.click
.....
* no refresh the grid here
thisform.grid.setfocus
* grid.refresh probably not necessary
ENDPROC
Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform