Solved

Scrolling a grid

Posted on 2014-01-12
3
1,414 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now