Solved

Scrolling a grid

Posted on 2014-01-12
3
1,503 Views
Last Modified: 2014-01-13
I would like records in my grid to scroll automatically when I open the tab with the grid. I would like the selected record to be in the middle of the grid if possible, or as close to the middle as possible if there are no enough records to populate the whole grid. How can I do that?

Also, position of the slider of the grid is somewhat confusing. If there are just a few records at the top of the grid, the slider is still not in the uppermost position, which makes an impression that there are some records hidden above the grid top. How can I fix that?

VFP6.

Thank you.
0
Comment
Question by:VitalyNagy
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 39775893
If you place the following command to the Page.Activate code then it should position the active record in the middle of the grid:

THIS.YourGrid.SetFocus

Note: SetFocus will "center" the grid active record when it is outside the visible area only. To center the active record in all situations you will need to move it outside the visible are by DoScroll, e.g.


THIS.YourGrid.DoScroll(3)
THIS.YourGrid.DoScroll(3)
THIS.YourGrid.SetFocus

etc.  (Use DoScroll(2) if you are close to the table bottom.)

The impression with your slider is maybe correct. If there are deleted records at the beginning of your table and SET DELETED is ON then the first visible record is not the record No. 1 in the table so the grid does not show the slider at the top. It is a bug maybe but to check the first visible record would cost reasonable amount of time which results in grid freezing or delays...

The workaround is to create a temp table/cursor which will contain just visible data.

Above code was tested in VFP 9. VFP 6 may behave slightly differently. You should upgrade to VFP 9 ASAP because it becomes unavailable...
0
 

Author Comment

by:VitalyNagy
ID: 39777208
Thank you. Where can I buy FoxPro 9?
0
 
LVL 41

Expert Comment

by:pcelba
ID: 39777313
Boxed product is not available, some used copies are at eBay from time to time.

You may buy VFP 9 license in almost any softwarehouse which delivers Microsoft software, e.g. http://www.cdw.com/shop/products/Microsoft-Visual-FoxPro-Professional-Edition-v.-9.0-license/748846.aspx

Open License program has some additional requirements which will make your first purchase about $40 more expensive.

VFP 9 is also available as a part of MSDN subscription.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question