Solved

Scrolling a grid

Posted on 2014-01-12
3
1,655 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

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 42

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
This article outlines the struggles that Macs encounter in Windows-dominated workplace environments – and what Mac users can do to improve their network connectivity and remain productive.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

630 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