Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preserving visual position of current record after updat
Message
From
10/05/2006 11:56:48
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
10/05/2006 11:12:15
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01120344
Message ID:
01120722
Views:
18
Hi Malcom,

I understand your question I just don't remember dealing with the problem. I don't think I worried about where the relativerow was as long and same row was highlighted when the data refresh was done. I use Andy Kramek's technique as well. Sorry I couldn't help further.

>Hi James,
>
>>I have never had the issue you describe. When I restore the row the grid seems to remember which row it was displaying. I am not replacing the cursor the grid is bound to. I am not sure what would happen if the cursor was
>
>Apologies and thanks for your patience ... I think I'm doing a terrible job describing my question :)
>
>I can correctly restore the previously selected record (easy part), but the record is not positioned at its original relativerow, but rather, following a grid's refresh, VFP moves the currently selected record to the middle row of the grid.
>
>I'm using Andy Kramek's "Safe Select" technique for updating my record source: I zap the current record source, run my query to a temp cursor, and then copy the temp cursor's contents to my grid's record source.
>
>Thanks for taking the time to look at this problem for me. If you think of anything else, let me know.
>
>Malcolm
>
>>>Your code successfully restores my previously selected record in a grid. This is the 1st part of a two part question :)
>>>
>>>The 2nd part of the question is how to position the selected record at the same relative row within the visible portion of the grid.
>>>
>>>VFP's native behavior is to position the re-selected record in the MIDDLE row of the visible grid. I want to position the re-selected record at its ORIGINAL position within the grid. (For sake of simplicity, you can assume that there will always be enough records in the record source ahead of the currently selected record to support this type of positioning)
>>>
>>>For example, if I have a grid that displays 10 rows in its visible area and my currently selected record is the 2nd visible row in the grid, when I restore my selected record, I want it to be restored to the 2nd visible row in the grid - NOT the middle of the grid as VFP does by default.
>>>
>>>Thanks for taking a stab at this question,
>>>
>>>Malcolm
>>>
>>>
>>>>I am not sure if this is what you are looking for but...
>>>>
>>>>
>>>>lnPK = table.pk
>>>>*refresh grid here
>>>>locate for table.pk = lnPK
>>>>if eof()
>>>>  go top
>>>>endif
>>>>grid.refresh()
>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform